From e1e15a68daa9a6a29a05b6d07808045edcb4f382 Mon Sep 17 00:00:00 2001 From: sorgelig Date: Wed, 16 Jan 2019 14:09:13 +0800 Subject: [PATCH] ScanDirectory: fix initial location. --- file_io.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/file_io.cpp b/file_io.cpp index 18d21c7..e9a698f 100644 --- a/file_io.cpp +++ b/file_io.cpp @@ -1035,17 +1035,18 @@ int ScanDirectory(char* path, int mode, const char *extension, int options, cons if (mode == SCANF_INIT) { file_name[0] = 0; - if (isPathRegularFile(path)) + if (!isPathDirectory(path)) { + bool isfile = isPathRegularFile(path); char *p = strrchr(path, '/'); if (p) { - strcpy(file_name, p + 1); + if (isfile) strcpy(file_name, p + 1); *p = 0; } else { - strcpy(file_name, path); + if (isfile) strcpy(file_name, path); path[0] = 0; } }