forked from qt-creator/qt-creator
cmake: resolve symlinks when comparing source directories.
Testcase: trying to use an existing build dir which was made for /d/foo where /d is a symlink to $HOME/d. To help understanding the problem, the error message now prints both source dirs, the one found in the builddir and the one we expected. Change-Id: I9a24fbd6ef3cf8108c5edba0d2a5b99ecdea0e89 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -207,9 +207,8 @@ bool FileUtils::isFileNewerThan(const FileName &filePath, const QDateTime &timeS
|
||||
}
|
||||
|
||||
/*!
|
||||
Recursively resolves possibly present symlinks in \a filePath.
|
||||
Unlike QFileInfo::canonicalFilePath(), this function will still return the expected target file
|
||||
even if the symlink is dangling.
|
||||
Recursively resolves symlinks if \a filePath is a symlink.
|
||||
To resolve symlinks anywhere in the path, see canonicalPath
|
||||
|
||||
\note Maximum recursion depth == 16.
|
||||
|
||||
@@ -226,6 +225,21 @@ FileName FileUtils::resolveSymlinks(const FileName &path)
|
||||
return FileName::fromString(f.filePath());
|
||||
}
|
||||
|
||||
/*!
|
||||
Recursively resolves possibly present symlinks in \a filePath.
|
||||
Unlike QFileInfo::canonicalFilePath(), this function will not return an empty
|
||||
string if path doesn't exist.
|
||||
|
||||
Returns the canonical path.
|
||||
*/
|
||||
FileName FileUtils::canonicalPath(const FileName &path)
|
||||
{
|
||||
const QString result = QFileInfo(path.toString()).canonicalFilePath();
|
||||
if (result.isEmpty())
|
||||
return path;
|
||||
return FileName::fromString(result);
|
||||
}
|
||||
|
||||
/*!
|
||||
Like QDir::toNativeSeparators(), but use prefix '~' instead of $HOME on unix systems when an
|
||||
absolute path is given.
|
||||
|
||||
Reference in New Issue
Block a user