diff options
Diffstat (limited to 'src/skel/crossplatform.cpp')
-rw-r--r-- | src/skel/crossplatform.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/skel/crossplatform.cpp b/src/skel/crossplatform.cpp index f2f9d5ee..37c94cb4 100644 --- a/src/skel/crossplatform.cpp +++ b/src/skel/crossplatform.cpp @@ -32,15 +32,15 @@ HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) { char *folder = strtok(pathCopy, "*"); char *extension = strtok(NULL, "*"); - // because strtok doesn't return NULL for last delimiter - if (extension - folder == strlen(pathname)) - extension = nil; + // because strtok doesn't return NULL for last delimiter + if (extension - folder == strlen(pathname)) + extension = nil; // Case-sensitivity and backslashes... - // Will be freed at the bottom - char *realFolder = casepath(folder); + // Will be freed at the bottom + char *realFolder = casepath(folder); if (realFolder) { - folder = realFolder; + folder = realFolder; } strncpy(firstfile->folder, folder, sizeof(firstfile->folder)); @@ -50,8 +50,8 @@ HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) { else firstfile->extension[0] = '\0'; - if (realFolder) - free(realFolder); + if (realFolder) + free(realFolder); HANDLE d; if ((d = (HANDLE)opendir(firstfile->folder)) == NULL || !FindNextFile(d, firstfile)) @@ -256,3 +256,17 @@ char* casepath(char const* path, bool checkPathFirst) return out; } #endif + +#if !defined(_MSC_VER) && !defined(__CWCC__) +char *strdate(char *buf) { + time_t timestamp; + time(×tamp); + tm *localTm = localtime(×tamp); + strftime(buf, 10, "%m/%d/%y", localTm); + return buf; +} + +char *_strdate(char *buf) { + return strdate(buf); +} +#endif |