Fixed path to data directory on linux.

Ideally we should use relative paths, which could make possible to run the game after using:
make install DESTDIR=./any/local/path

I also added path to "supertuxkart-assets" directory, which cmake already search.
This commit is contained in:
Deve 2014-08-25 21:52:42 +02:00
parent 0b4532b6da
commit 4b597b97b7

View File

@ -150,7 +150,7 @@ FileManager::FileManager()
if(exe_path.size()==0 || exe_path[exe_path.size()-1]!='/') if(exe_path.size()==0 || exe_path[exe_path.size()-1]!='/')
exe_path += "/"; exe_path += "/";
if ( getenv ( "SUPERTUXKART_DATADIR" ) != NULL ) if ( getenv ( "SUPERTUXKART_DATADIR" ) != NULL )
root_dir = std::string(getenv("SUPERTUXKART_DATADIR"))+"/" ; root_dir = std::string(getenv("SUPERTUXKART_DATADIR"))+"/data/" ;
#ifdef __APPLE__ #ifdef __APPLE__
else if( macSetBundlePathIfRelevant( root_dir ) ) { root_dir = root_dir + "data/"; } else if( macSetBundlePathIfRelevant( root_dir ) ) { root_dir = root_dir + "data/"; }
#endif #endif
@ -174,7 +174,7 @@ FileManager::FileManager()
else else
{ {
#ifdef SUPERTUXKART_DATADIR #ifdef SUPERTUXKART_DATADIR
root_dir = SUPERTUXKART_DATADIR; root_dir = SUPERTUXKART_DATADIR"/data/";
if(root_dir.size()==0 || root_dir[root_dir.size()-1]!='/') if(root_dir.size()==0 || root_dir[root_dir.size()-1]!='/')
root_dir+='/'; root_dir+='/';
@ -186,6 +186,8 @@ FileManager::FileManager()
addRootDirs(root_dir); addRootDirs(root_dir);
if( fileExists(root_dir+"../../stk-assets")) if( fileExists(root_dir+"../../stk-assets"))
addRootDirs(root_dir+"../../stk-assets"); addRootDirs(root_dir+"../../stk-assets");
if( fileExists(root_dir+"../../supertuxkart-assets"))
addRootDirs(root_dir+"../../supertuxkart-assets");
if ( getenv ( "SUPERTUXKART_ROOT_PATH" ) != NULL ) if ( getenv ( "SUPERTUXKART_ROOT_PATH" ) != NULL )
addRootDirs(getenv("SUPERTUXKART_ROOT_PATH")); addRootDirs(getenv("SUPERTUXKART_ROOT_PATH"));