Skip to content

Commit

Permalink
Merged pull request "Sync with Q2PRO: Filesystem changes (again)": NV…
Browse files Browse the repository at this point in the history
  • Loading branch information
apanteleev committed Dec 7, 2023
2 parents c2fafb4 + 52106ca commit f496c6a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions inc/common/files.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion inc/shared/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/unix/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/windows/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f496c6a

Please sign in to comment.