31 lines
1.2 KiB
Plaintext
31 lines
1.2 KiB
Plaintext
|
--- 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)
|