summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-11-01 13:27:00 +0300
committerAndrei Karas <akaras@inbox.ru>2013-11-01 21:33:36 +0300
commit748b2dc257650d9ff6e740496802cb977227bc21 (patch)
tree8b609eebf4b0733d5f0ccb5586d9c1999afba846
parente8ce245e0bbb87bc45d15b9f0eb8bf423373d203 (diff)
downloadplus-748b2dc257650d9ff6e740496802cb977227bc21.tar.gz
plus-748b2dc257650d9ff6e740496802cb977227bc21.tar.bz2
plus-748b2dc257650d9ff6e740496802cb977227bc21.tar.xz
plus-748b2dc257650d9ff6e740496802cb977227bc21.zip
move package directory variable from client into paths.
-rw-r--r--src/client.cpp3
-rw-r--r--src/client.h4
-rw-r--r--src/resources/resourcemanager.cpp4
-rw-r--r--src/utils/paths.cpp15
-rw-r--r--src/utils/paths.h4
5 files changed, 22 insertions, 8 deletions
diff --git a/src/client.cpp b/src/client.cpp
index dd5b06776..130ddcc80 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -278,7 +278,6 @@ class LoginListener final : public gcn::ActionListener
Client::Client(const Options &options) :
gcn::ActionListener(),
mOptions(options),
- mPackageDir(),
mConfigDir(),
mServerConfigDir(),
mLocalDataDir(),
@@ -548,7 +547,7 @@ void Client::gameInit()
// mPackageDir = path;
#endif
resman->addToSearchPath(PKG_DATADIR "data", false);
- mPackageDir = PKG_DATADIR "data";
+ setPackageDir(PKG_DATADIR "data");
resman->addToSearchPath("data", false);
#ifdef ANDROID
diff --git a/src/client.h b/src/client.h
index 48801b274..9d1a23266 100644
--- a/src/client.h
+++ b/src/client.h
@@ -233,9 +233,6 @@ public:
State getState() const A_WARN_UNUSED
{ return mState; }
- const std::string &getPackageDirectory() const A_WARN_UNUSED
- { return mPackageDir; }
-
const std::string &getConfigDirectory() const A_WARN_UNUSED
{ return mConfigDir; }
@@ -390,7 +387,6 @@ private:
Options mOptions;
- std::string mPackageDir;
std::string mConfigDir;
std::string mServerConfigDir;
std::string mLocalDataDir;
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 5cdb22e96..d50df6b50 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -39,6 +39,7 @@
#include "resources/spritedef.h"
#include "utils/mkdir.h"
+#include "utils/paths.h"
#include "utils/physfscheckutils.h"
#include "utils/physfsrwops.h"
#include "utils/sdlcheckutils.h"
@@ -427,8 +428,7 @@ std::string ResourceManager::getPath(const std::string &file) const
else
{
// if not found in search path return the default path
- path = std::string(client->getPackageDirectory()).append(
- dirSeparator).append(file);
+ path = getPackageDir().append(dirSeparator).append(file);
}
return path;
diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp
index dbe0cccce..cba263027 100644
--- a/src/utils/paths.cpp
+++ b/src/utils/paths.cpp
@@ -52,6 +52,11 @@
#include "debug.h"
+namespace
+{
+ std::string mPackageDir;
+} // namespace
+
std::string getRealPath(const std::string &str)
{
#if defined(__OpenBSD__) || defined(__ANDROID__) || defined(__native_client__)
@@ -193,3 +198,13 @@ std::string getSdStoragePath()
return getenv("DATADIR2");
}
#endif
+
+std::string getPackageDir()
+{
+ return mPackageDir;
+}
+
+void setPackageDir(const std::string &dir)
+{
+ mPackageDir = dir;
+}
diff --git a/src/utils/paths.h b/src/utils/paths.h
index 6e2d17808..cb0af64ad 100644
--- a/src/utils/paths.h
+++ b/src/utils/paths.h
@@ -43,4 +43,8 @@ std::string getDesktopDir() A_WARN_UNUSED;
std::string getSdStoragePath() A_WARN_UNUSED;
#endif
+std::string getPackageDir() A_WARN_UNUSED;
+
+void setPackageDir(const std::string &dir);
+
#endif // UTILS_PATHS_H