From de51abd18f3cd9cd486837da69264b841d6cfff6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 21 Feb 2013 00:54:47 +0300 Subject: Improve physfs calls to get dir separator. --- src/utils/paths.cpp | 2 +- src/utils/physfstools.cpp | 11 ++++++++++- src/utils/physfstools.h | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/utils') diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp index 271178c23..f97ccafcb 100644 --- a/src/utils/paths.cpp +++ b/src/utils/paths.cpp @@ -79,7 +79,7 @@ bool checkPath(std::string path) std::string &fixDirSeparators(std::string &str) { - if (*PhysFs::getDirSeparator() == '/') + if (dirSeparator[0] == '/') return str; return replaceAll(str, "/", "\\"); diff --git a/src/utils/physfstools.cpp b/src/utils/physfstools.cpp index 06df8fccf..1fcb8fb1b 100644 --- a/src/utils/physfstools.cpp +++ b/src/utils/physfstools.cpp @@ -20,11 +20,20 @@ #include "utils/physfstools.h" +#include "logger.h" + +const char *dirSeparator = nullptr; + namespace PhysFs { + void updateDirSeparator() + { + dirSeparator = PHYSFS_getDirSeparator(); + } + const char *getDirSeparator() { - return PHYSFS_getDirSeparator(); + return dirSeparator; } const char *getBaseDir() diff --git a/src/utils/physfstools.h b/src/utils/physfstools.h index f917a0841..7bfe6b14d 100644 --- a/src/utils/physfstools.h +++ b/src/utils/physfstools.h @@ -25,6 +25,7 @@ namespace PhysFs { + void updateDirSeparator(); const char *getDirSeparator(); const char *getBaseDir(); const char *getUserDir(); @@ -42,4 +43,6 @@ namespace PhysFs bool mkdir(const char *dirName); } +extern const char *dirSeparator; + #endif // UTILS_PHYSFS_H -- cgit v1.2.3-70-g09d2