X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=lib%2Fapp%2Fsetup.cpp;h=c7972c470323bc8b2a025df720cb5fa51b9d9d49;hb=2e9cf5dbc6b66dda4f94b0c1943a9e3719569435;hp=d8c10af4c40798c04208a3844550c71b5c5206c1;hpb=45d21c1c59a58aa557b62d3aa22ba89a975e323c;p=supertux.git diff --git a/lib/app/setup.cpp b/lib/app/setup.cpp index d8c10af4c..c7972c470 100644 --- a/lib/app/setup.cpp +++ b/lib/app/setup.cpp @@ -252,6 +252,15 @@ std::set FileSystem::dfiles(const std::string& rel_path, const std return sdirs; } +std::string FileSystem::dirname(const std::string& filename) +{ + std::string::size_type p = filename.find_last_of('/'); + if(p == std::string::npos) + return ""; + + return filename.substr(0, p+1); +} + void Setup::init(const std::string& _package_name, const std::string& _package_symbol_name, const std::string& _package_version) @@ -294,7 +303,7 @@ void Setup::directories() // try current directory as datadir if(datadir.empty()) { - if(FileSystem::faccessible("./data/intro.txt")) + if(FileSystem::faccessible("./data/credits.txt")) datadir = "./data/"; } @@ -313,10 +322,10 @@ void Setup::directories() { std::string exedir = std::string(dirname(exe_file)) + "/"; - datadir = exedir + "../data/"; // SuperTux run from source dir + datadir = exedir + "./data/"; // SuperTux run from source dir if (access(datadir.c_str(), F_OK) != 0) { - datadir = exedir + "../../data/"; //SuperTux run from source dir (with libtool script) + datadir = exedir + "../../../../data/"; //SuperTux run from source dir (with libtool script) if (access(datadir.c_str(), F_OK) != 0) {