summaryrefslogtreecommitdiff
path: root/src/fs/paths.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-04 17:43:11 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-04 17:43:40 +0300
commit2ac4af7560ae6596f442600843acc9fe9cfe7964 (patch)
tree83e2fdb70d23b207104d42bab6d6cb29d002dd86 /src/fs/paths.cpp
parent787caddc0074df0b3fb217bad561be8fd71ca5b9 (diff)
downloadmv-2ac4af7560ae6596f442600843acc9fe9cfe7964.tar.gz
mv-2ac4af7560ae6596f442600843acc9fe9cfe7964.tar.bz2
mv-2ac4af7560ae6596f442600843acc9fe9cfe7964.tar.xz
mv-2ac4af7560ae6596f442600843acc9fe9cfe7964.zip
Improve join some paths.
Diffstat (limited to 'src/fs/paths.cpp')
-rw-r--r--src/fs/paths.cpp24
1 files changed, 14 insertions, 10 deletions
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
}