resourcemanager:[bug fix] directoryExists method should resolvePath before checking (#1102)

This commit is contained in:
vfjpl 2020-08-29 17:35:42 +02:00 committed by GitHub
parent 88d0ea34bf
commit 9c1f519f8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,14 +156,13 @@ void ResourceManager::searchAndAddPackages(const std::string& packagesDir, const
bool ResourceManager::fileExists(const std::string& fileName) bool ResourceManager::fileExists(const std::string& fileName)
{ {
const std::string path = resolvePath(fileName); return (PHYSFS_exists(resolvePath(fileName).c_str()) && !directoryExists(fileName));
return (PHYSFS_exists(path.c_str()) && !directoryExists(path));
} }
bool ResourceManager::directoryExists(const std::string& directoryName) bool ResourceManager::directoryExists(const std::string& directoryName)
{ {
PHYSFS_Stat stat = {}; PHYSFS_Stat stat = {};
if (!PHYSFS_stat(directoryName.c_str(), &stat)) { if (!PHYSFS_stat(resolvePath(directoryName).c_str(), &stat)) {
return false; return false;
} }