mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-26 16:15:39 +00:00
Merge pull request #549 from tomaz82/eliminate_iequivalent
Fix FilesystemUtil::isEquivalent by eliminating it entirely
This commit is contained in:
commit
e45458dee6
|
@ -237,11 +237,9 @@ void updateGamelist(SystemData* system)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string nodePath = Utils::FileSystem::resolveRelativePath(pathNode.text().get(), system->getStartPath(), true);
|
std::string nodePath = Utils::FileSystem::getCanonicalPath(Utils::FileSystem::resolveRelativePath(pathNode.text().get(), system->getStartPath(), true));
|
||||||
std::string gamePath = (*fit)->getPath();
|
std::string gamePath = Utils::FileSystem::getCanonicalPath((*fit)->getPath());
|
||||||
if(nodePath == gamePath || (Utils::FileSystem::exists(nodePath) &&
|
if(nodePath == gamePath)
|
||||||
Utils::FileSystem::exists(gamePath) &&
|
|
||||||
Utils::FileSystem::isEquivalent(nodePath, gamePath)))
|
|
||||||
{
|
{
|
||||||
// found it
|
// found it
|
||||||
root.remove_child(fileNode);
|
root.remove_child(fileNode);
|
||||||
|
|
|
@ -652,22 +652,6 @@ namespace Utils
|
||||||
|
|
||||||
} // isHidden
|
} // isHidden
|
||||||
|
|
||||||
bool isEquivalent(const std::string& _path1, const std::string& _path2)
|
|
||||||
{
|
|
||||||
std::string path1 = getGenericPath(_path1);
|
|
||||||
std::string path2 = getGenericPath(_path2);
|
|
||||||
struct stat64 info1;
|
|
||||||
struct stat64 info2;
|
|
||||||
|
|
||||||
// check if stat64 succeeded
|
|
||||||
if((stat64(path1.c_str(), &info1) != 0) || (stat64(path2.c_str(), &info2) != 0))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// check if attributes are identical
|
|
||||||
return ((info1.st_dev == info2.st_dev) && (info1.st_ino == info2.st_ino) && (info1.st_size == info2.st_size) && (info1.st_mtime == info2.st_mtime));
|
|
||||||
|
|
||||||
} // isEquivalent
|
|
||||||
|
|
||||||
} // FileSystem::
|
} // FileSystem::
|
||||||
|
|
||||||
} // Utils::
|
} // Utils::
|
||||||
|
|
|
@ -37,7 +37,6 @@ namespace Utils
|
||||||
bool isDirectory (const std::string& _path);
|
bool isDirectory (const std::string& _path);
|
||||||
bool isSymlink (const std::string& _path);
|
bool isSymlink (const std::string& _path);
|
||||||
bool isHidden (const std::string& _path);
|
bool isHidden (const std::string& _path);
|
||||||
bool isEquivalent (const std::string& _path1, const std::string& _path2);
|
|
||||||
|
|
||||||
} // FileSystem::
|
} // FileSystem::
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue