From 023876dafb450b0339df7819efdd67557b564173 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 10 Jan 2011 18:21:44 +0200 Subject: [PATCH] fixed data path in porting.cpp for normal linux builds to get data from /binary/dir/../share/APPNAME --- src/porting.cpp | 12 ++++++++++-- 1 file 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 - 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 */