diff --git a/inc/common/files.h b/inc/common/files.h index ab528400d..273f3d5b7 100644 --- a/inc/common/files.h +++ b/inc/common/files.h @@ -61,13 +61,14 @@ typedef struct file_info_s { #define FS_PATH_GAME 0x00000080 #define FS_PATH_MASK 0x000000c0 -// bits 8 - 12, flag +// bits 8 - 13, flag #define FS_SEARCH_BYFILTER 0x00000100 #define FS_SEARCH_SAVEPATH 0x00000200 #define FS_SEARCH_EXTRAINFO 0x00000400 #define FS_SEARCH_STRIPEXT 0x00000800 #define FS_SEARCH_DIRSONLY 0x00001000 -#define FS_SEARCH_MASK 0x00001f00 +#define FS_SEARCH_RECURSIVE 0x00002000 +#define FS_SEARCH_MASK 0x00003f00 // bits 8 - 12, flag #define FS_FLAG_GZIP 0x00000100 // transparently (de)compress with gzip diff --git a/inc/shared/platform.h b/inc/shared/platform.h index a529bddd5..9288aa0c4 100644 --- a/inc/shared/platform.h +++ b/inc/shared/platform.h @@ -64,7 +64,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define os_stat(p, s) _stat64(p, s) #define os_fstat(f, s) _fstat64(f, s) #define os_fileno(f) _fileno(f) -#define os_access(p, m) _access(p, m) +#define os_access(p, m) _access(p, (m) & ~X_OK) #define Q_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) #define Q_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) #define Q_STATBUF struct _stat64 diff --git a/src/unix/system.c b/src/unix/system.c index f4620a1a1..1107f8ba8 100644 --- a/src/unix/system.c +++ b/src/unix/system.c @@ -454,8 +454,8 @@ void Sys_ListFiles_r(listfiles_t *list, const char *path, int depth) } // pattern search implies recursive search - if ((list->flags & FS_SEARCH_BYFILTER) && - S_ISDIR(st.st_mode) && depth < MAX_LISTED_DEPTH) { + if ((list->flags & (FS_SEARCH_BYFILTER | FS_SEARCH_RECURSIVE)) + && S_ISDIR(st.st_mode) && depth < MAX_LISTED_DEPTH) { Sys_ListFiles_r(list, fullpath, depth + 1); // re-check count diff --git a/src/windows/system.c b/src/windows/system.c index a5834466c..bfaf9ee45 100644 --- a/src/windows/system.c +++ b/src/windows/system.c @@ -1081,8 +1081,8 @@ void Sys_ListFiles_r(listfiles_t *list, const char *path, int depth) } // pattern search implies recursive search - if ((list->flags & FS_SEARCH_BYFILTER) && mask && - depth < MAX_LISTED_DEPTH) { + if ((list->flags & (FS_SEARCH_BYFILTER | FS_SEARCH_RECURSIVE)) + && mask && depth < MAX_LISTED_DEPTH) { Sys_ListFiles_r(list, fullpath, depth + 1); // re-check count