forked from qt-creator/qt-creator
Utils: Add FilePath::isSameFile()
FilePath::isSameFile() checks if two files are the same file. It first checks if its on the same device. If it is, it will try to read the fileId of the files and compare them. Change-Id: I83668955cacd4e5ed03d43a3fee2be29e9d0a6f0 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -175,13 +175,7 @@ bool Environment::isSameExecutable(const QString &exe1, const QString &exe2) con
|
||||
for (const QString &i2 : exe2List) {
|
||||
const FilePath f1 = FilePath::fromString(i1);
|
||||
const FilePath f2 = FilePath::fromString(i2);
|
||||
if (f1 == f2)
|
||||
return true;
|
||||
if (f1.needsDevice() != f2.needsDevice() || f1.scheme() != f2.scheme())
|
||||
return false;
|
||||
if (f1.resolveSymlinks() == f2.resolveSymlinks())
|
||||
return true;
|
||||
if (FileUtils::fileId(f1) == FileUtils::fileId(f2))
|
||||
if (f1.isSameFile(f2))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user