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/utils/files.cpp | 6 ++++-- src/utils/files.h | 7 ++++--- src/utils/gettext.h | 4 ++-- src/utils/mkdir.cpp | 3 +++ src/utils/paths.cpp | 9 ++++++++- 5 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src/utils') diff --git a/src/utils/files.cpp b/src/utils/files.cpp index f4c93e6e6..c06b3d892 100644 --- a/src/utils/files.cpp +++ b/src/utils/files.cpp @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -#ifdef ANDROID +#if defined(ANDROID) || defined(__native_client__) #include "utils/files.h" #include "logger.h" @@ -30,6 +30,7 @@ #include "localconsts.h" +#ifdef ANDROID void Files::extractLocale() { // in future need also remove all locales in local dir @@ -60,6 +61,7 @@ void Files::extractLocale() resman->removeFromSearchPath(fileName2); remove(fileName2.c_str()); } +#endif // ANDROID void Files::copyPhysFsFile(const std::string &inFile, const std::string &outFile) @@ -98,4 +100,4 @@ void Files::extractZip(const std::string &zipName, const std::string &inDir, remove(zipName.c_str()); } -#endif // ANDROID +#endif // ANDROID __native_client__ diff --git a/src/utils/files.h b/src/utils/files.h index bb9a6a11f..519b7f520 100644 --- a/src/utils/files.h +++ b/src/utils/files.h @@ -21,13 +21,14 @@ #ifndef UTILS_FILES_H #define UTILS_FILES_H -#ifdef ANDROID +#if defined(ANDROID) || defined(__native_client__) #include namespace Files { +#ifdef ANDROID void extractLocale(); - +#endif void copyPhysFsFile(const std::string &inFile, const std::string &outFile); void copyPhysFsDir(const std::string &inDir, const std::string &outDir); @@ -36,5 +37,5 @@ namespace Files const std::string &outDir); } // namespace Files -#endif // ANDROID +#endif // ANDROID __native_client__ #endif // UTILS_FILES_H diff --git a/src/utils/gettext.h b/src/utils/gettext.h index ed686cffd..a00e44898 100644 --- a/src/utils/gettext.h +++ b/src/utils/gettext.h @@ -27,10 +27,10 @@ #include "config.h" #endif -#include - #ifdef ENABLE_NLS +#include + #define _(s) (const_cast (gettext(s))) #define N_(s) (const_cast (s)) diff --git a/src/utils/mkdir.cpp b/src/utils/mkdir.cpp index fc6909710..959b15b04 100644 --- a/src/utils/mkdir.cpp +++ b/src/utils/mkdir.cpp @@ -36,6 +36,8 @@ #include #endif +#include + #include "debug.h" #if defined WIN32 @@ -112,6 +114,7 @@ int mkdir_r(const char *const pathname) return 0; } #else + /// Create a directory, making leading components first if necessary int mkdir_r(const char *const pathname) { diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp index e3992cd72..dbe0cccce 100644 --- a/src/utils/paths.cpp +++ b/src/utils/paths.cpp @@ -30,11 +30,18 @@ #include "resources/resourcemanager.h" +#ifdef __native_client__ +#include +#define realpath(N, R) strcpy(R, N) +#endif + #ifdef WIN32 #include "utils/specialfolder.h" #define realpath(N, R) _fullpath((R), (N), _MAX_PATH) #elif defined __OpenBSD__ #include +#elif defined __native_client__ +#include #endif #ifdef ANDROID @@ -47,7 +54,7 @@ std::string getRealPath(const std::string &str) { -#if defined(__OpenBSD__) || defined(__ANDROID__) +#if defined(__OpenBSD__) || defined(__ANDROID__) || defined(__native_client__) char *realPath = reinterpret_cast(calloc(PATH_MAX, sizeof(char))); realpath(str.c_str(), realPath); #else -- cgit v1.2.3-70-g09d2