Skip to content

Commit

Permalink
Merge pull request #549 from tomaz82/eliminate_iequivalent
Browse files Browse the repository at this point in the history
Fix FilesystemUtil::isEquivalent by eliminating it entirely
  • Loading branch information
joolswills authored Mar 13, 2019
2 parents f9e4889 + 07a9f18 commit e45458d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
8 changes: 3 additions & 5 deletions es-app/src/Gamelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,9 @@ void updateGamelist(SystemData* system)
continue;
}

std::string nodePath = Utils::FileSystem::resolveRelativePath(pathNode.text().get(), system->getStartPath(), true);
std::string gamePath = (*fit)->getPath();
if(nodePath == gamePath || (Utils::FileSystem::exists(nodePath) &&
Utils::FileSystem::exists(gamePath) &&
Utils::FileSystem::isEquivalent(nodePath, gamePath)))
std::string nodePath = Utils::FileSystem::getCanonicalPath(Utils::FileSystem::resolveRelativePath(pathNode.text().get(), system->getStartPath(), true));
std::string gamePath = Utils::FileSystem::getCanonicalPath((*fit)->getPath());
if(nodePath == gamePath)
{
// found it
root.remove_child(fileNode);
Expand Down
16 changes: 0 additions & 16 deletions es-core/src/utils/FileSystemUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,22 +652,6 @@ namespace Utils

} // 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::

} // Utils::
1 change: 0 additions & 1 deletion es-core/src/utils/FileSystemUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ namespace Utils
bool isDirectory (const std::string& _path);
bool isSymlink (const std::string& _path);
bool isHidden (const std::string& _path);
bool isEquivalent (const std::string& _path1, const std::string& _path2);

} // FileSystem::

Expand Down

0 comments on commit e45458d

Please sign in to comment.