From: Matthias Braun Date: Tue, 7 Jun 2005 23:07:13 +0000 (+0000) Subject: only add installdir to searchpath if nothing was found in current dir X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=67a45a221992139fcea531e4de17ee72821fe655;p=supertux.git only add installdir to searchpath if nothing was found in current dir SVN-Revision: 2582 --- diff --git a/src/main.cpp b/src/main.cpp index d31b9f682..2b05e6c20 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -140,29 +140,34 @@ static void init_physfs(const char* argv0) dir += "/data"; std::string testfname = dir; testfname += "/credits.txt"; + bool sourcedir = false; FILE* f = fopen(testfname.c_str(), "r"); if(f) { fclose(f); if(!PHYSFS_addToSearchPath(dir.c_str(), 1)) { std::cout << "Warning: Couldn't add '" << dir << "' to physfs searchpath: " << PHYSFS_getLastError() << "\n"; + } else { + sourcedir = true; } } + if(!sourcedir) { #if defined(APPDATADIR) || defined(ENABLE_BINRELOC) - std::string datadir; + std::string datadir; #ifdef ENABLE_BINRELOC - char* brdatadir = br_strcat(DATADIR, "/" PACKAGE_NAME); - datadir = brdatadir; - free(brdatadir); + char* brdatadir = br_strcat(DATADIR, "/" PACKAGE_NAME); + datadir = brdatadir; + free(brdatadir); #else - datadir = APPDATADIR; + datadir = APPDATADIR; #endif - if(!PHYSFS_addToSearchPath(datadir.c_str(), 1)) { - std::cout << "Couldn't add '" << datadir - << "' to physfs searchpath: " << PHYSFS_getLastError() << "\n"; - } + if(!PHYSFS_addToSearchPath(datadir.c_str(), 1)) { + std::cout << "Couldn't add '" << datadir + << "' to physfs searchpath: " << PHYSFS_getLastError() << "\n"; + } #endif + } // allow symbolic links PHYSFS_permitSymbolicLinks(1);