summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-06-08 17:27:30 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-07-20 17:59:48 +0200
commitbcd3e1af2f2d2f29ca739ee138ef72357b5b7b3a (patch)
tree6262b4ce9fc33ab22dec52c5630017599cfaf3f8
parentcd45ae3d0f8da00f0be69dee015e3298acce1367 (diff)
downloadminetest-bcd3e1af2f2d2f29ca739ee138ef72357b5b7b3a.tar.gz
minetest-bcd3e1af2f2d2f29ca739ee138ef72357b5b7b3a.tar.bz2
minetest-bcd3e1af2f2d2f29ca739ee138ef72357b5b7b3a.zip
Check the data path before usage
When not running in place, check if the assumed data path in ../share/APPNAME exists. If it doesn't exist, fall back to ../data instead. This allows the program to run successfully from the checkout directory even without the run-in-place flag active.
-rw-r--r--src/porting.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/porting.cpp b/src/porting.cpp
index 7de042ab5..ff8cb3862 100644
--- a/src/porting.cpp
+++ b/src/porting.cpp
@@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "porting.h"
#include "config.h"
#include "debug.h"
+#include "filesys.h"
#ifdef __APPLE__
#include "CoreFoundation/CoreFoundation.h"
@@ -210,6 +211,11 @@ void initializePaths()
path_data = std::string(buf) + "/../share/" + APPNAME;
//path_data = std::string(INSTALL_PREFIX) + "/share/" + APPNAME;
+ if (!fs::PathExists(path_data)) {
+ dstream<<"WARNING: data path " << path_data << " not found!";
+ path_data = std::string(buf) + "/../data";
+ dstream<<" Trying " << path_data << std::endl;
+ }
path_userdata = std::string(getenv("HOME")) + "/." + APPNAME;