Skip to content

Commit

Permalink
Don't list mod directories at Windows drive root
Browse files Browse the repository at this point in the history
Merge of ioquake/ioq3@10a45cb

See commit for full description and details
  • Loading branch information
ensiform committed Jul 15, 2023
1 parent 282ac9b commit b4ca650
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/unix/unix_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ void Sys_ListFilteredFiles( const char *basedir, const char *subdirs, const char
return;
}

if ( basedir[0] == '\0' ) {
return;
}

if ( *subdirs ) {
Com_sprintf( search, sizeof(search), "%s/%s", basedir, subdirs );
}
Expand Down Expand Up @@ -214,6 +218,11 @@ char **Sys_ListFiles( const char *directory, const char *extension, const char *
return listCopy;
}

if ( directory[0] == '\0' ) {
*numfiles = 0;
return NULL;
}

if ( !extension)
extension = "";

Expand Down
9 changes: 9 additions & 0 deletions src/win32/win_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ void Sys_ListFilteredFiles( const char *basedir, const char *subdirs, const char
return;
}

if ( basedir[0] == '\0' ) {
return;
}

if ( *subdirs ) {
Com_sprintf( search, sizeof(search), "%s\\%s\\*", basedir, subdirs );
}
Expand Down Expand Up @@ -450,6 +454,11 @@ char **Sys_ListFiles( const char *directory, const char *extension, const char *
return listCopy;
}

if ( directory[0] == '\0' ) {
*numfiles = 0;
return NULL;
}

if ( !extension ) {
extension = "";
}
Expand Down

0 comments on commit b4ca650

Please sign in to comment.