summaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-03 02:12:42 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-03 18:44:58 +0300
commit9e72886ee15acc39cbb6075ce32a60a5391ea9f3 (patch)
treefd7d0b05eeaed5ab0016cad58772cab7456f36b4 /src/fs
parent49631972db5b965413d4bbe36983a8d5bd203183 (diff)
downloadplus-9e72886ee15acc39cbb6075ce32a60a5391ea9f3.tar.gz
plus-9e72886ee15acc39cbb6075ce32a60a5391ea9f3.tar.bz2
plus-9e72886ee15acc39cbb6075ce32a60a5391ea9f3.tar.xz
plus-9e72886ee15acc39cbb6075ce32a60a5391ea9f3.zip
Replace string::append with pathJoin.
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/files.cpp11
-rw-r--r--src/fs/paths.cpp15
2 files changed, 11 insertions, 15 deletions
diff --git a/src/fs/files.cpp b/src/fs/files.cpp
index dbbf248d2..215076b99 100644
--- a/src/fs/files.cpp
+++ b/src/fs/files.cpp
@@ -44,15 +44,14 @@ void Files::extractLocale()
{
// in future need also remove all locales in local dir
- const std::string fileName2 = std::string(getenv(
- "APPDIR")).append("/locale.zip");
+ const std::string fileName2 = pathJoin(getenv("APPDIR"), "locale.zip");
VirtFs::mountZip(fileName2, Append_false);
const std::string localDir = std::string(getenv("APPDIR")).append("/");
VirtList *const rootDirs = VirtFs::enumerateFiles("locale");
FOR_EACH (StringVectCIter, i, rootDirs->names)
{
- const std::string dir = std::string("locale/").append(*i);
+ const std::string dir = pathJoin("locale", *i);
if (VirtFs::isDirectory(dir))
{
const std::string moFile = dir + "/LC_MESSAGES/manaplus.mo";
@@ -112,8 +111,8 @@ void Files::copyVirtFsDir(const std::string &restrict inDir,
VirtList *const files = VirtFs::enumerateFiles(inDir);
FOR_EACH (StringVectCIter, i, files->names)
{
- const std::string file = std::string(inDir).append("/").append(*i);
- const std::string outDir2 = std::string(outDir).append("/").append(*i);
+ const std::string file = pathJoin(inDir, *i);
+ const std::string outDir2 = pathJoin(outDir, *i);
if (VirtFs::isDirectory(file))
copyVirtFsDir(file, outDir2);
else
@@ -257,7 +256,7 @@ void Files::saveTextFile(std::string path,
if (!mkdir_r(path.c_str()))
{
std::ofstream file;
- std::string fileName = path.append("/").append(name);
+ std::string fileName = pathJoin(path, name);
file.open(fileName.c_str(), std::ios::out);
if (file.is_open())
{
diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp
index a5941f084..e5fcdd7d3 100644
--- a/src/fs/paths.cpp
+++ b/src/fs/paths.cpp
@@ -191,12 +191,12 @@ std::string getPicturesDir()
std::string file;
if (!xdg)
{
- file = std::string(VirtFs::getUserDir()).append(
- "/.config/user-dirs.dirs");
+ file = pathJoin(VirtFs::getUserDir(),
+ ".config/user-dirs.dirs");
}
else
{
- file = std::string(xdg).append("/user-dirs.dirs");
+ file = pathJoin(xdg, "user-dirs.dirs");
}
StringVect arr;
@@ -212,16 +212,13 @@ std::string getPicturesDir()
replaceAll(str, "$HOME/", VirtFs::getUserDir());
str = getRealPath(str);
if (str.empty())
- str = std::string(VirtFs::getUserDir()).append("Desktop");
+ str = pathJoin(VirtFs::getUserDir(), "Desktop");
return str;
}
}
-
- return std::string(VirtFs::getUserDir()).append("Desktop");
-#else // WIN32
-
- return std::string(VirtFs::getUserDir()).append("Desktop");
#endif // WIN32
+
+ return pathJoin(VirtFs::getUserDir(), "Desktop");
}
std::string getHomePath()