diff options
Diffstat (limited to 'filesystem-win.c')
-rw-r--r-- | filesystem-win.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/filesystem-win.c b/filesystem-win.c index d9ff143..f27fe82 100644 --- a/filesystem-win.c +++ b/filesystem-win.c @@ -22,7 +22,9 @@ char **fs_list_directory(char const *dirname) { char **ret = NULL; WIN32_FIND_DATA find_data; HANDLE fhandle; - sprintf_s(file_pattern, sizeof file_pattern, "%s\\*", dirname); + assert(*dirname); + sprintf_s(file_pattern, sizeof file_pattern, "%s%s*", dirname, + dirname[strlen(dirname) - 1] == PATH_SEPARATOR ? "" : PATH_SEPARATOR_STR); fhandle = FindFirstFileA(file_pattern, &find_data); if (fhandle != INVALID_HANDLE_VALUE) { // first, figure out number of files |