fixed data path in porting.cpp for normal linux builds to get data from /binary/dir...
authorPerttu Ahola <celeron55@gmail.com>
Mon, 10 Jan 2011 16:21:44 +0000 (18:21 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Mon, 10 Jan 2011 16:21:44 +0000 (18:21 +0200)
src/porting.cpp

index 6686a657e180baa440ce0d24e419e60547f32340..a1e6fd02dc3316361418bd3baa109cab35d0d1ae 100644 (file)
@@ -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
        */