diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-01-10 18:21:44 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-01-10 18:21:44 +0200 |
commit | 023876dafb450b0339df7819efdd67557b564173 (patch) | |
tree | 4a11d6440207a551f2197a067c9e6a62110f984e | |
parent | 56918c0ca47582c425e56017115df852df1fa886 (diff) | |
download | minetest-023876dafb450b0339df7819efdd67557b564173.tar.gz minetest-023876dafb450b0339df7819efdd67557b564173.tar.bz2 minetest-023876dafb450b0339df7819efdd67557b564173.zip |
fixed data path in porting.cpp for normal linux builds to get data from /binary/dir/../share/APPNAME
-rw-r--r-- | src/porting.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/porting.cpp b/src/porting.cpp index 6686a657e..a1e6fd02d 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -143,9 +143,17 @@ void initializePaths() #elif defined(linux) #include <unistd.h> - path_userdata = std::string(getenv("HOME")) + "/." + APPNAME; - path_data = std::string(INSTALL_PREFIX) + "/share/" + APPNAME; + char buf[BUFSIZ]; + // Get path to executable + readlink("/proc/self/exe", buf, BUFSIZ); + pathRemoveFile(buf, '/'); + + path_data = std::string(buf) + "/../share/" + APPNAME; + //path_data = std::string(INSTALL_PREFIX) + "/share/" + APPNAME; + + path_userdata = std::string(getenv("HOME")) + "/." + APPNAME; + /* OS X */ |