From 7f2484d82112851dbeba83afd18790a58b03599d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 29 Oct 2013 23:36:53 +0300 Subject: Initial porting to NACL by Vasily_Makarov. --- src/client.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index 8f1110162..24ed15987 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -140,12 +140,17 @@ #include #include +#include #include #include "mumblemanager.h" #include "debug.h" +#if defined __native_client__ +#define _nacl_dir std::string("/persistent/manaplus") +#endif + /** * Tells the max tick value, * setting it back to zero (and start again). @@ -400,6 +405,12 @@ void Client::gameInit() #endif #endif +#if defined __native_client__ + + const std::string dirName = _nacl_dir.append("/data"); + Files::extractZip("/http/data.zip", "data", dirName); +#endif + #ifdef ENABLE_NLS std::string lang = config.getStringValue("lang"); #ifdef WIN32 @@ -551,6 +562,11 @@ void Client::gameInit() } #endif #endif + +#if defined __native_client__ + resman->addToSearchPath(_nacl_dir.append("/data"), false); +#endif + // Add branding/data to PhysFS search path if (!mOptions.brandingPath.empty()) { @@ -756,11 +772,13 @@ Client::~Client() void Client::bindTextDomain(const char *const name, const char *const path) { +#ifdef ENABLE_NLS const char *const dir = bindtextdomain(name, path); if (dir) logger->log("bindtextdomain: %s", dir); else logger->log("bindtextdomain failed"); +#endif } void Client::setEnv(const char *const name, const char *const value) @@ -1944,6 +1962,8 @@ void Client::initLocalDataDir() #elif defined __ANDROID__ mLocalDataDir = getSdStoragePath() + branding.getValue( "appShort", "ManaPlus") + "/local"; +#elif defined __native_client__ + mLocalDataDir = _nacl_dir.append("/local"); #else mLocalDataDir = std::string(PhysFs::getUserDir()) + ".local/share/mana"; @@ -2001,6 +2021,8 @@ void Client::initConfigDir() #elif defined __ANDROID__ mConfigDir = getSdStoragePath() + branding.getValue( "appShort", "ManaPlus").append("/config"); +#elif defined __native_client__ + mConfigDir = _nacl_dir.append("/config"); #else mConfigDir = std::string(PhysFs::getUserDir()).append( "/.config/mana/").append(branding.getValue("appShort", "mana")); -- cgit v1.2.3-70-g09d2