diff --git a/src/w_file.c b/src/w_file.c index 3a73d363..2fc17a42 100644 --- a/src/w_file.c +++ b/src/w_file.c @@ -37,14 +37,14 @@ static int FileLength(int descriptor) return st.st_size; } -static void W_FILE_AddDir(w_handle_t handle, const char *path, - const char *start_marker, const char *end_marker) +static boolean W_FILE_AddDir(w_handle_t handle, const char *path, + const char *start_marker, const char *end_marker) { int startlump = numlumps; glob_t *glob; - if (!strcmp(path, ".")) + if (path[0] == '.') { glob = I_StartGlob(handle.p1.base_path, "*.*", GLOB_FLAG_NOCASE | GLOB_FLAG_SORTED); @@ -58,7 +58,7 @@ static void W_FILE_AddDir(w_handle_t handle, const char *path, if (!glob) { - return; + return false; } while (true) @@ -103,6 +103,8 @@ static void W_FILE_AddDir(w_handle_t handle, const char *path, { W_AddMarker(end_marker); } + + return true; } static int *descriptors = NULL; diff --git a/src/w_internal.h b/src/w_internal.h index 23cc8efc..8cf17254 100644 --- a/src/w_internal.h +++ b/src/w_internal.h @@ -25,8 +25,8 @@ typedef enum typedef struct w_module_s { - void (*AddDir)(w_handle_t handle, const char *path, - const char *start_marker, const char *end_marker); + boolean (*AddDir)(w_handle_t handle, const char *path, + const char *start_marker, const char *end_marker); w_type_t (*Open)(const char *path, w_handle_t *handle); void (*Read)(w_handle_t handle, void *dest, int size); void (*Close)(void); diff --git a/src/w_wad.c b/src/w_wad.c index aebef24f..396b30c3 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -129,7 +129,10 @@ static w_module_t *modules[] = static void AddDirs(w_module_t *module, w_handle_t handle, const char *base) { - module->AddDir(handle, base, NULL, NULL); + if (!module->AddDir(handle, base, NULL, NULL)) + { + return; + } for (int i = 0; i < arrlen(subdirs); ++i) { diff --git a/src/w_zip.c b/src/w_zip.c index 5ef9b7e4..5c75f63a 100644 --- a/src/w_zip.c +++ b/src/w_zip.c @@ -101,8 +101,8 @@ static void AddWadInMem(mz_zip_archive *zip, const char *name, int index, } } -static void W_ZIP_AddDir(w_handle_t handle, const char *path, - const char *start_marker, const char *end_marker) +static boolean W_ZIP_AddDir(w_handle_t handle, const char *path, + const char *start_marker, const char *end_marker) { mz_zip_archive *zip = handle.p1.zip; @@ -121,7 +121,7 @@ static void W_ZIP_AddDir(w_handle_t handle, const char *path, if (index < 0) { - return; + return false; } ++index; @@ -185,6 +185,8 @@ static void W_ZIP_AddDir(w_handle_t handle, const char *path, { W_AddMarker(end_marker); } + + return true; } static mz_zip_archive **zips = NULL;