diff options
author | erorcun <erorcunerorcun@hotmail.com.tr> | 2020-10-23 00:56:32 +0200 |
---|---|---|
committer | erorcun <erorcunerorcun@hotmail.com.tr> | 2020-10-23 00:56:32 +0200 |
commit | bedc066cfd888226100c431886ef3c923a9a9950 (patch) | |
tree | 3148e6db2bc8f5ce1e5df49f7b1240310afbebc9 /src | |
parent | Fix argument type (diff) | |
download | re3-bedc066cfd888226100c431886ef3c923a9a9950.tar re3-bedc066cfd888226100c431886ef3c923a9a9950.tar.gz re3-bedc066cfd888226100c431886ef3c923a9a9950.tar.bz2 re3-bedc066cfd888226100c431886ef3c923a9a9950.tar.lz re3-bedc066cfd888226100c431886ef3c923a9a9950.tar.xz re3-bedc066cfd888226100c431886ef3c923a9a9950.tar.zst re3-bedc066cfd888226100c431886ef3c923a9a9950.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/skel/crossplatform.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/skel/crossplatform.cpp b/src/skel/crossplatform.cpp index 626403f8..65cfde45 100644 --- a/src/skel/crossplatform.cpp +++ b/src/skel/crossplatform.cpp @@ -27,23 +27,24 @@ void GetLocalTime_CP(SYSTEMTIME *out) { #ifndef _WIN32 HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) { char pathCopy[32]; + char constructedPath[32]; strncpy(pathCopy, pathname, 32); char* folder = strtok(pathCopy, "*"); - + // Case-sensitivity and backslashes... char *realFolder = casepath(folder); char *extension = nil; if (realFolder) { - realFolder[strlen(realFolder)] = '*'; + sprintf(constructedPath, "%s*", realFolder); extension = strtok(NULL, "*"); if (extension) { - strcat(realFolder, extension); + strcat(constructedPath, extension); } - - strncpy(pathCopy, realFolder, 32); + free(realFolder); - folder = strtok(pathCopy, "*"); + folder = strtok(constructedPath, "*"); + extension = strtok(NULL, "*"); } else { // Wildcard (*) if (strlen(folder) + 1 != strlen(pathname)) |