From 83f74b86fe81d17a3ee9b3fd2bd2b305d39d85ef Mon Sep 17 00:00:00 2001 From: BjossiAlfreds Date: Fri, 24 Jul 2026 17:35:15 +0000 Subject: [PATCH] common: FS_Dir_f uses FS_ListFilesx --- src/common/filesystem.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/common/filesystem.c b/src/common/filesystem.c index 80475e0a..8995234b 100644 --- a/src/common/filesystem.c +++ b/src/common/filesystem.c @@ -1761,13 +1761,12 @@ FS_ListMods(void) static void FS_Dir_f(void) { - char **dirnames; /* File list. */ + strlist_t dirs; char findname[1024]; /* File search path and pattern. */ const char *path = NULL; /* Search path. */ char *lastsep; char wildcard[1024] = "*.*"; /* File pattern. */ int i; /* Loop counter. */ - int ndirs; /* Number of files in list. */ /* Check for pattern in arguments. */ if (Cmd_Argc() != 1) @@ -1782,24 +1781,23 @@ FS_Dir_f(void) Com_Printf("Directory of '%s'.\n", findname); Com_Printf("----\n"); - if ((dirnames = FS_ListFiles(findname, &ndirs, 0, 0)) != 0) - { - for (i = 0; i < ndirs - 1; i++) - { - lastsep = strrchr(dirnames[i], '/'); - if (lastsep) - { - Com_Printf("%s\n", lastsep + 1); - } - else - { - Com_Printf("%s\n", dirnames[i]); - } - } + dirs = FS_ListFilesx(findname, 0, 0); - FS_FreeList(dirnames, ndirs); + for (i = 0; i < dirs.num; i++) + { + lastsep = strrchr(dirs.data[i], '/'); + if (lastsep) + { + Com_Printf("%s\n", lastsep + 1); + } + else + { + Com_Printf("%s\n", dirs.data[i]); + } } + StrList_Free(&dirs); + Com_Printf("\n"); } }