From: Perttu Ahola Date: Mon, 10 Jan 2011 16:21:44 +0000 (+0200) Subject: fixed data path in porting.cpp for normal linux builds to get data from /binary/dir... X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=023876dafb450b0339df7819efdd67557b564173;p=zefram%2Fminetest%2Fminetest_engine.git fixed data path in porting.cpp for normal linux builds to get data from /binary/dir/../share/APPNAME --- diff --git a/src/porting.cpp b/src/porting.cpp index 6686a657..a1e6fd02 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -143,9 +143,17 @@ void initializePaths() #elif defined(linux) #include - 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 */