summaryrefslogtreecommitdiff
path: root/src/dirs.cpp
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/dirs.cpp
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/dirs.cpp')
-rw-r--r--src/dirs.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/dirs.cpp b/src/dirs.cpp
index d72881545..85383543a 100644
--- a/src/dirs.cpp
+++ b/src/dirs.cpp
@@ -103,8 +103,8 @@ void extractAssets()
logger->log("error: APPDIR is not set!");
return;
}
- const std::string fileName = std::string(getenv(
- "APPDIR")).append("/data.zip");
+ const std::string fileName = pathJoin(getenv("APPDIR"),
+ "data.zip");
logger->log("Extracting asset into: " + fileName);
uint8_t *buf = new uint8_t[1000000];
@@ -132,8 +132,8 @@ void extractAssets()
}
fclose(file);
- const std::string fileName2 = std::string(getenv(
- "APPDIR")).append("/locale.zip");
+ const std::string fileName2 = pathJoin(getenv("APPDIR"),
+ "locale.zip");
FILE *const file2 = fopen(fileName2.c_str(), "w");
SDL_RWops *const rw = SDL_RWFromFile("manaplus-locale.zip", "r");
if (rw)
@@ -177,12 +177,8 @@ void Dirs::extractDataDir()
resetProgress();
extractAssets();
- const std::string zipName = std::string(getenv(
- "APPDIR")).append(
- "/data.zip");
- const std::string dirName = std::string(getenv(
- "APPDIR")).append(
- "/data");
+ const std::string zipName = pathJoin(getenv("APPDIR"), "data.zip");
+ const std::string dirName = pathJoin(getenv("APPDIR"), "data");
Files::extractZip(zipName, "data", dirName);
Files::extractLocale();
#endif // defined(ANDROID) && defined(USE_SDL2)
@@ -397,18 +393,21 @@ void Dirs::initConfigDir()
}
else
{
- settings.configDir.append("/mana/").append(branding.getValue(
- "appShort", "mana"));
+ settings.configDir = pathJoin(settings.configDir,
+ "mana",
+ branding.getValue("appShort", "mana"));
}
#elif defined __ANDROID__
- settings.configDir = getSdStoragePath() + branding.getValue(
- "appShort", "ManaPlus").append("/config");
+ settings.configDir = pathJoin(getSdStoragePath(),
+ branding.getValue("appShort", "ManaPlus"),
+ "config");
#elif defined __native_client__
settings.configDir = pathJoin(_nacl_dir, "config");
#else // __APPLE__
- settings.configDir = std::string(VirtFs::getUserDir()).append(
- "/.config/mana/").append(branding.getValue("appShort", "mana"));
+ settings.configDir = pathJoin(VirtFs::getUserDir(),
+ ".config/mana",
+ branding.getValue("appShort", "mana"));
#endif // __APPLE__
logger->log("Generating config dir: " + settings.configDir);
@@ -440,10 +439,7 @@ void Dirs::initUpdatesDir()
if (settings.updateHost.length() < 2)
{
if (settings.updatesDir.empty())
- {
- settings.updatesDir = std::string("updates/").append(
- settings.serverName);
- }
+ settings.updatesDir = pathJoin("updates", settings.serverName);
return;
}