summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-29 23:36:53 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-29 23:39:29 +0300
commit7f2484d82112851dbeba83afd18790a58b03599d (patch)
tree6449022bbae8a55825febc7b08e3d4095f1de64f /src/utils
parent24179041d619875bda96eb94307b1f3dd64e6add (diff)
downloadmv-7f2484d82112851dbeba83afd18790a58b03599d.tar.gz
mv-7f2484d82112851dbeba83afd18790a58b03599d.tar.bz2
mv-7f2484d82112851dbeba83afd18790a58b03599d.tar.xz
mv-7f2484d82112851dbeba83afd18790a58b03599d.zip
Initial porting to NACL by Vasily_Makarov.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/files.cpp6
-rw-r--r--src/utils/files.h7
-rw-r--r--src/utils/gettext.h4
-rw-r--r--src/utils/mkdir.cpp3
-rw-r--r--src/utils/paths.cpp9
5 files changed, 21 insertions, 8 deletions
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 <http://www.gnu.org/licenses/>.
*/
-#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 <string>
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 <libintl.h>
-
#ifdef ENABLE_NLS
+#include <libintl.h>
+
#define _(s) (const_cast <char*>(gettext(s)))
#define N_(s) (const_cast <char*>(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 <cstdlib>
#endif
+#include <errno.h>
+
#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 <limits.h>
+#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 <limits>
+#elif defined __native_client__
+#include <limits.h>
#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<char*>(calloc(PATH_MAX, sizeof(char)));
realpath(str.c_str(), realPath);
#else