summaryrefslogtreecommitdiff
path: root/src/fs/files.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/files.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/files.cpp')
-rw-r--r--src/fs/files.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/fs/files.cpp b/src/fs/files.cpp
index 3bb3262da..03b478cbe 100644
--- a/src/fs/files.cpp
+++ b/src/fs/files.cpp
@@ -47,7 +47,7 @@ void Files::extractLocale()
const std::string fileName2 = pathJoin(getenv("APPDIR"), "locale.zip");
VirtFs::mountZip(fileName2, Append_false);
- const std::string localDir = std::string(getenv("APPDIR")).append("/");
+ const std::string localDir = std::string(getenv("APPDIR"));
VirtList *const rootDirs = VirtFs::enumerateFiles("locale");
FOR_EACH (StringVectCIter, i, rootDirs->names)
{
@@ -57,8 +57,10 @@ void Files::extractLocale()
const std::string moFile = dir + "/LC_MESSAGES/manaplus.mo";
if (VirtFs::exists((moFile)))
{
- const std::string localFile = localDir + moFile;
- const std::string localDir2 = localDir + dir + "/LC_MESSAGES";
+ const std::string localFile = pathJoin(localDir, moFile);
+ const std::string localDir2 = pathJoin(localDir,
+ dir,
+ "LC_MESSAGES");
mkdir_r(localDir2.c_str());
copyVirtFsFile(moFile, localFile);
}
@@ -273,7 +275,7 @@ void Files::saveTextFile(const std::string &path,
void Files::deleteFilesInDirectory(std::string path)
{
- path += "/";
+ path == pathJoin(path, dirSeparator);
const struct dirent *next_file = nullptr;
DIR *const dir = opendir(path.c_str());
@@ -293,8 +295,8 @@ void Files::enumFiles(StringVect &files,
std::string path,
const bool skipSymlinks A_WIN_UNUSED)
{
- if (findLast(path, "/") == false)
- path += "/";
+ if (findLast(path, dirSeparator) == false)
+ path += dirSeparator;
const struct dirent *next_file = nullptr;
DIR *const dir = opendir(path.c_str());