summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-15 02:18:57 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-15 02:23:36 +0300
commit99bc9d1fb4bccae0785d731711e3b1009de1b394 (patch)
treee2ff1d19052011eceaa11baec788e5808dc68a3c
parenta72b60b50e639bcd309baadf4199252510cb8118 (diff)
downloadplus-99bc9d1fb4bccae0785d731711e3b1009de1b394.tar.gz
plus-99bc9d1fb4bccae0785d731711e3b1009de1b394.tar.bz2
plus-99bc9d1fb4bccae0785d731711e3b1009de1b394.tar.xz
plus-99bc9d1fb4bccae0785d731711e3b1009de1b394.zip
Replace some hardcoded dir separator to physfs.
-rw-r--r--src/chatlogger.cpp12
-rw-r--r--src/client.cpp22
-rw-r--r--src/map.cpp3
-rw-r--r--src/resources/resourcemanager.cpp4
4 files changed, 26 insertions, 15 deletions
diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp
index 33763e561..b8418edda 100644
--- a/src/chatlogger.cpp
+++ b/src/chatlogger.cpp
@@ -42,6 +42,8 @@
#include "utils/mkdir.h"
#include "utils/stringutils.h"
+#include <physfs.h>
+
#include "debug.h"
ChatLogger::ChatLogger() :
@@ -172,11 +174,17 @@ void ChatLogger::setServerName(const std::string &serverName)
secureName(mServerName);
if (mLogDir != "")
{
- DIR *dir = opendir((mLogDir + "/" + mServerName).c_str());
+ DIR *dir = opendir((mLogDir + PHYSFS_getDirSeparator()
+ + mServerName).c_str());
if (!dir)
- mkdir_r((mLogDir + "/" + mServerName).c_str());
+ {
+ mkdir_r((mLogDir + PHYSFS_getDirSeparator()
+ + mServerName).c_str());
+ }
else
+ {
closedir(dir);
+ }
}
}
diff --git a/src/client.cpp b/src/client.cpp
index ed3656ee0..4bd60e977 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -443,7 +443,8 @@ void Client::gameInit()
}
else
{
- mOptions.dataPath = branding.getDirectory() + "/"
+ mOptions.dataPath = branding.getDirectory()
+ + PHYSFS_getDirSeparator()
+ branding.getStringValue("dataPath");
}
mOptions.skipUpdate = true;
@@ -1137,17 +1138,17 @@ int Client::gameExec()
}
else if (loginData.updateType & LoginData::Upd_Skip)
{
- UpdaterWindow::loadLocalUpdates(mLocalDataDir + "/"
- + mUpdatesDir);
+ UpdaterWindow::loadLocalUpdates(mLocalDataDir
+ + PHYSFS_getDirSeparator() + mUpdatesDir);
mState = STATE_LOAD_DATA;
}
else
{
logger->log1("State: UPDATE");
mCurrentDialog = new UpdaterWindow(mUpdateHost,
- mLocalDataDir + "/" + mUpdatesDir,
- mOptions.dataPath.empty(),
- loginData.updateType);
+ mLocalDataDir + PHYSFS_getDirSeparator()
+ + mUpdatesDir, mOptions.dataPath.empty(),
+ loginData.updateType);
}
break;
@@ -1175,7 +1176,8 @@ int Client::gameExec()
"zip",
false);
- resman->addToSearchPath(mLocalDataDir + "/"
+ resman->addToSearchPath(mLocalDataDir
+ + PHYSFS_getDirSeparator()
+ mUpdatesDir + "/local/", false);
}
@@ -1610,7 +1612,7 @@ void Client::initConfigDir()
if (mConfigDir.empty())
{
#ifdef __APPLE__
- mConfigDir = mLocalDataDir + "/"
+ mConfigDir = mLocalDataDir + PHYSFS_getDirSeparator()
+ branding.getValue("appShort", "mana");
#elif defined __HAIKU__
mConfigDir = std::string(PHYSFS_getUserDir()) +
@@ -1642,7 +1644,7 @@ void Client::initConfigDir()
*/
void Client::initServerConfig(std::string serverName)
{
- mServerConfigDir = mConfigDir + "/" + serverName;
+ mServerConfigDir = mConfigDir + PHYSFS_getDirSeparator() + serverName;
if (mkdir_r(mServerConfigDir.c_str()))
{
@@ -1877,7 +1879,7 @@ void Client::initScreenshotDir()
if (!configScreenshotSuffix.empty())
{
- mScreenshotDir += "/" + configScreenshotSuffix;
+ mScreenshotDir += PHYSFS_getDirSeparator() + configScreenshotSuffix;
// config.setValue("screenshotDirectorySuffix",
// configScreenshotSuffix);
}
diff --git a/src/map.cpp b/src/map.cpp
index 3ea9989a4..b8767e5e4 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -42,6 +42,7 @@
#include "utils/mkdir.h"
#include <limits.h>
+#include <physfs.h>
#include <sys/stat.h>
@@ -1251,7 +1252,7 @@ void Map::saveExtraLayer()
std::string Map::getUserMapDirectory() const
{
- return Client::getServerConfigDirectory() + "/"
+ return Client::getServerConfigDirectory() + PHYSFS_getDirSeparator()
+ getProperty("_realfilename");
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 7adeaa268..ec8764a44 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -329,12 +329,12 @@ std::string ResourceManager::getPath(const std::string &file)
// if the file is not in the search path, then its nullptr
if (tmp)
{
- path = std::string(tmp) + "/" + file;
+ path = std::string(tmp) + PHYSFS_getDirSeparator() + file;
}
else
{
// if not found in search path return the default path
- path = Client::getPackageDirectory() + "/" + file;
+ path = Client::getPackageDirectory() + PHYSFS_getDirSeparator() + file;
}
return path;