diff options
Diffstat (limited to 'dviware/dvisvgm/src/FileSystem.cpp')
-rw-r--r-- | dviware/dvisvgm/src/FileSystem.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/dviware/dvisvgm/src/FileSystem.cpp b/dviware/dvisvgm/src/FileSystem.cpp index 35621465a5..6a081ee24f 100644 --- a/dviware/dvisvgm/src/FileSystem.cpp +++ b/dviware/dvisvgm/src/FileSystem.cpp @@ -50,7 +50,6 @@ using namespace std; #endif -FileSystem FileSystem::_fs; string FileSystem::TMPDIR; const char *FileSystem::TMPSUBDIR = nullptr; @@ -133,8 +132,10 @@ uint64_t FileSystem::filesize (const string &fname) { } -string FileSystem::adaptPathSeperators (string path) { +string FileSystem::ensureForwardSlashes (string path) { +#ifdef _WIN32 std::replace(path.begin(), path.end(), PATHSEP, '/'); +#endif return path; } @@ -142,7 +143,7 @@ string FileSystem::adaptPathSeperators (string path) { string FileSystem::getcwd () { char buf[1024]; #ifdef _WIN32 - return adaptPathSeperators(_getcwd(buf, 1024)); + return ensureForwardSlashes(_getcwd(buf, 1024)); #else return ::getcwd(buf, 1024); #endif @@ -198,7 +199,7 @@ string FileSystem::tmpdir () { #ifdef _WIN32 char buf[MAX_PATH]; if (GetTempPath(MAX_PATH, buf)) - ret = adaptPathSeperators(buf); + ret = ensureForwardSlashes(buf); else ret = "."; #else @@ -232,7 +233,7 @@ bool FileSystem::mkdir (const string &dirname) { bool success = false; if (const char *cdirname = dirname.c_str()) { success = true; - const string dirstr = adaptPathSeperators(util::trim(cdirname)); + const string dirstr = ensureForwardSlashes(util::trim(cdirname)); for (size_t pos=1; success && (pos = dirstr.find('/', pos)) != string::npos; pos++) success &= s_mkdir(dirstr.substr(0, pos)); success &= s_mkdir(dirstr); |