summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-11-18 04:24:33 +0300
committerAndrei Karas <akaras@inbox.ru>2012-11-18 04:24:33 +0300
commit868514ac621b3ca5c0a9f924461e37164dc712ff (patch)
tree60ef7bb390d4cca25081c7d6eeb809da2193aee3 /src/client.cpp
parentdb00f34d1c385c8ec007a077c2f78aef764d3bbb (diff)
downloadmv-868514ac621b3ca5c0a9f924461e37164dc712ff.tar.gz
mv-868514ac621b3ca5c0a9f924461e37164dc712ff.tar.bz2
mv-868514ac621b3ca5c0a9f924461e37164dc712ff.tar.xz
mv-868514ac621b3ca5c0a9f924461e37164dc712ff.zip
Add support for persistent directory under Android.
This directory used for updates, configs, logs.
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 38e30b22f..208858555 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -547,6 +547,7 @@ void Client::gameInit()
SDLImageHelper::SDLSetEnableAlphaCache(config.getBoolValue("alphaCache"));
ImageHelper::setEnableAlpha(config.getFloatValue("guialpha") != 1.0f);
#endif
+ logVars();
graphicsManager.initGraphics(mOptions.noOpenGL);
runCounters = config.getBoolValue("packetcounters");
applyVSync();
@@ -1804,7 +1805,8 @@ void Client::initLocalDataDir()
mLocalDataDir = std::string(PHYSFS_getUserDir());
mLocalDataDir += "/Mana";
#elif defined __ANDROID__
- mLocalDataDir = "local";
+ mLocalDataDir = getenv("DATADIR2") + branding.getValue(
+ "appShort", "ManaPlus") + "/local";
#else
mLocalDataDir = std::string(PHYSFS_getUserDir()) +
".local/share/mana";
@@ -1852,7 +1854,8 @@ void Client::initConfigDir()
else
mConfigDir += "/mana/" + branding.getValue("appShort", "mana");
#elif defined __ANDROID__
- mConfigDir = "config";
+ mConfigDir = getenv("DATADIR2") + branding.getValue(
+ "appShort", "ManaPlus") + "/config";
#else
mConfigDir = std::string(PHYSFS_getUserDir()) +
"/.config/mana/" + branding.getValue("appShort", "mana");
@@ -2098,12 +2101,17 @@ void Client::initScreenshotDir()
}
else if (mScreenshotDir.empty())
{
+#ifdef __ANDROID__
+ mLocalDataDir = getenv("DATADIR2") + std::string("/images");
+#else
std::string configScreenshotDir =
config.getStringValue("screenshotDirectory");
if (!configScreenshotDir.empty())
mScreenshotDir = configScreenshotDir;
else
mScreenshotDir = getDesktopDir();
+#endif
+
//config.setValue("screenshotDirectory", mScreenshotDir);
logger->log("screenshotDirectory: " + mScreenshotDir);
@@ -2730,3 +2738,12 @@ void Client::newChatMessage()
client->mNewMessageFlag = true;
}
}
+
+void Client::logVars()
+{
+#ifdef ANDROID
+ logger->log("APPDIR: %s", getenv("APPDIR"));
+ logger->log("DATADIR: %s", getenv("DATADIR"));
+ logger->log("DATADIR2: %s", getenv("DATADIR2"));
+#endif
+}