summaryrefslogtreecommitdiff
path: root/src/utils/physfstools.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-11-09 17:59:14 +0300
committerAndrei Karas <akaras@inbox.ru>2013-11-09 17:59:14 +0300
commitdb1e60556c72b1b87ff2a384c556ccca724c46d6 (patch)
tree22a5f4e9c4f436ef8e746e0a2d688de80c1597a6 /src/utils/physfstools.cpp
parentc2bb49be52a92deccec7428b6859242688fc8987 (diff)
parent1716861f0ee2f7a3714c5b44bb0f017c3d8d3b2c (diff)
downloadplus-db1e60556c72b1b87ff2a384c556ccca724c46d6.tar.gz
plus-db1e60556c72b1b87ff2a384c556ccca724c46d6.tar.bz2
plus-db1e60556c72b1b87ff2a384c556ccca724c46d6.tar.xz
plus-db1e60556c72b1b87ff2a384c556ccca724c46d6.zip
Merge branch 'master' into stable
Diffstat (limited to 'src/utils/physfstools.cpp')
-rw-r--r--src/utils/physfstools.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/utils/physfstools.cpp b/src/utils/physfstools.cpp
index cf87fa9ab..325f7cddc 100644
--- a/src/utils/physfstools.cpp
+++ b/src/utils/physfstools.cpp
@@ -20,12 +20,37 @@
#include "utils/physfstools.h"
+#include <iostream>
+#include <unistd.h>
+
+#ifdef ANDROID
+#include "utils/paths.h"
+#endif
+
#include "localconsts.h"
const char *dirSeparator = nullptr;
namespace PhysFs
{
+ void init(const char *const name)
+ {
+#if defined(__native_client__)
+ if (!PHYSFS_init("/fakebinary"))
+#elif defined(ANDROID)
+ if (!PHYSFS_init((getRealPath(".").append("/fakebinary")).c_str()))
+#else
+ if (!PHYSFS_init(name))
+#endif
+ {
+ std::cout << "Error while initializing PhysFS: "
+ << PHYSFS_getLastError() << std::endl;
+ _exit(1);
+ }
+ updateDirSeparator();
+ atexit((void(*)()) PHYSFS_deinit);
+ }
+
void updateDirSeparator()
{
dirSeparator = PHYSFS_getDirSeparator();