forked from Mirrorlandia_minetest/minetest
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.
This commit is contained in:
parent
3321edae77
commit
8fa94c3547
@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "filesys.h"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include "CoreFoundation/CoreFoundation.h"
|
#include "CoreFoundation/CoreFoundation.h"
|
||||||
@ -210,6 +211,11 @@ void initializePaths()
|
|||||||
|
|
||||||
path_data = std::string(buf) + "/../share/" + APPNAME;
|
path_data = std::string(buf) + "/../share/" + APPNAME;
|
||||||
//path_data = std::string(INSTALL_PREFIX) + "/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;
|
path_userdata = std::string(getenv("HOME")) + "/." + APPNAME;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user