From 2ac4af7560ae6596f442600843acc9fe9cfe7964 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 4 May 2017 17:43:11 +0300 Subject: Improve join some paths. --- src/fs/paths.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/fs/paths.cpp') diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp index e5fcdd7d3..4c7d66ce5 100644 --- a/src/fs/paths.cpp +++ b/src/fs/paths.cpp @@ -106,15 +106,19 @@ bool checkPath(const std::string &path) void prepareFsPath(std::string &path) { -// std::string path2 = path; +#ifdef DEBUGFS + std::string path2 = path; +#endif sanitizePath(path); // can be enabled for debugging -// if (path != path2) -// { -// reportAlways("Path can be improved: '%s' -> '%s'", -// path2.c_str(), -// path0.c_str()); -// } +#ifdef DEBUGFS + if (path != path2) + { + reportAlways("Path can be improved: '%s' -> '%s'", + path2.c_str(), + path.c_str()); + } +#endif } std::string &fixDirSeparators(std::string &str) @@ -237,11 +241,11 @@ std::string getHomePath() path = pw->pw_dir; } if (path == nullptr) - return "/"; + return dirSeparator; } std::string dir = path; - if (findLast(dir, "/") == false) - dir += "/"; + if (findLast(dir, std::string(dirSeparator)) == false) + dir += dirSeparator; return dir; #endif // WIN32 } -- cgit v1.2.3-60-g2f50