You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.2 KiB

--- src/framework/core/resourcemanager.cpp
+++ src/framework/core/resourcemanager.cpp
@@ -34,19 +35,21 @@
void ResourceManager::discoverWorkDir(const std::string& existentFile)
{
// search for modules directory
- std::string sep = PHYSFS_getDirSeparator();
- std::string possiblePaths[] = { boost::filesystem::current_path().generic_string() + sep,
- g_resources.getBaseDir() + ".." + sep};
+ std::string possiblePaths[] = { g_resources.getCurrentDir(),
+ g_resources.getBaseDir(),
+ g_resources.getBaseDir() + "../" };
bool found = false;
for(const std::string& dir : possiblePaths) {
- // try to directory to modules path to see if it exists
- std::ifstream fin(dir + existentFile);
- if(fin) {
+ if(!PHYSFS_addToSearchPath(dir.c_str(), 0))
+ continue;
+
+ if(PHYSFS_exists(existentFile.c_str())) {
g_logger.debug(stdext::format("Found work dir at '%s'", dir.c_str()));
m_workDir = dir;
found = true;
break;
}
+ PHYSFS_removeFromSearchPath(dir.c_str());
}
if(!found)