forked from qt-creator/qt-creator
Utils: Rename FilePath::absolutePath(FilePath) to resolvePath
There was already a similar function taking a QString. After that, the remaining no-argument version of absolutePath() can be deprecated. Change-Id: I5b9ad8c8b68a5723891b0aa9f5a37e90db0fe09e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -381,12 +381,19 @@ bool FilePath::isRelativePath() const
|
|||||||
return isRelativePathHelper(m_data, osType());
|
return isRelativePathHelper(m_data, osType());
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath FilePath::resolvePath(const QString &fileName) const
|
FilePath FilePath::resolvePath(const FilePath &tail) const
|
||||||
{
|
{
|
||||||
if (FileUtils::isAbsolutePath(fileName))
|
if (!isRelativePathHelper(tail.m_data, osType()))
|
||||||
return FilePath::fromString(QDir::cleanPath(fileName));
|
return tail;
|
||||||
|
return pathAppended(tail.m_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
FilePath FilePath::resolvePath(const QString &tail) const
|
||||||
|
{
|
||||||
|
if (!FileUtils::isRelativePath(tail))
|
||||||
|
return FilePath::fromString(QDir::cleanPath(tail));
|
||||||
FilePath result = *this;
|
FilePath result = *this;
|
||||||
result.setPath(QDir::cleanPath(m_data + '/' + fileName));
|
result.setPath(QDir::cleanPath(m_data + '/' + tail));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -846,13 +853,6 @@ FilePath FilePath::absoluteFilePath() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath FilePath::absoluteFilePath(const FilePath &tail) const
|
|
||||||
{
|
|
||||||
if (isRelativePathHelper(tail.m_data, osType()))
|
|
||||||
return pathAppended(tail.m_data);
|
|
||||||
return tail;
|
|
||||||
}
|
|
||||||
|
|
||||||
FilePath FilePath::normalizedPathName() const
|
FilePath FilePath::normalizedPathName() const
|
||||||
{
|
{
|
||||||
FilePath result = *this;
|
FilePath result = *this;
|
||||||
|
@@ -117,7 +117,6 @@ public:
|
|||||||
FilePath parentDir() const;
|
FilePath parentDir() const;
|
||||||
FilePath absolutePath() const;
|
FilePath absolutePath() const;
|
||||||
FilePath absoluteFilePath() const;
|
FilePath absoluteFilePath() const;
|
||||||
FilePath absoluteFilePath(const FilePath &tail) const;
|
|
||||||
|
|
||||||
// makes sure that capitalization of directories is canonical
|
// makes sure that capitalization of directories is canonical
|
||||||
// on Windows and macOS. This is rarely needed.
|
// on Windows and macOS. This is rarely needed.
|
||||||
@@ -155,7 +154,8 @@ public:
|
|||||||
FilePath relativePath(const FilePath &anchor) const;
|
FilePath relativePath(const FilePath &anchor) const;
|
||||||
FilePath pathAppended(const QString &str) const;
|
FilePath pathAppended(const QString &str) const;
|
||||||
FilePath stringAppended(const QString &str) const;
|
FilePath stringAppended(const QString &str) const;
|
||||||
FilePath resolvePath(const QString &fileName) const;
|
FilePath resolvePath(const FilePath &tail) const;
|
||||||
|
FilePath resolvePath(const QString &tail) const;
|
||||||
FilePath cleanPath() const;
|
FilePath cleanPath() const;
|
||||||
|
|
||||||
FilePath canonicalPath() const;
|
FilePath canonicalPath() const;
|
||||||
|
@@ -516,7 +516,7 @@ public:
|
|||||||
if (filePath.isAbsolutePath())
|
if (filePath.isAbsolutePath())
|
||||||
return filePath;
|
return filePath;
|
||||||
|
|
||||||
const FilePath fromWorkingDir = workingDir.absoluteFilePath(filePath);
|
const FilePath fromWorkingDir = workingDir.resolvePath(filePath);
|
||||||
if (fromWorkingDir.exists() && fromWorkingDir.isExecutableFile())
|
if (fromWorkingDir.exists() && fromWorkingDir.isExecutableFile())
|
||||||
return fromWorkingDir;
|
return fromWorkingDir;
|
||||||
return filePath.searchInPath();
|
return filePath.searchInPath();
|
||||||
|
@@ -1255,10 +1255,10 @@ void CMakeBuildSystem::updateInitialCMakeExpandableVars()
|
|||||||
// this is not 100% correct since CMake resolve them to CMAKE_CURRENT_SOURCE_DIR
|
// this is not 100% correct since CMake resolve them to CMAKE_CURRENT_SOURCE_DIR
|
||||||
// depending on context, but we cannot do better here
|
// depending on context, but we cannot do better here
|
||||||
return first == second
|
return first == second
|
||||||
|| projectDirectory.absoluteFilePath(first)
|
|| projectDirectory.resolvePath(first)
|
||||||
== projectDirectory.absoluteFilePath(second)
|
== projectDirectory.resolvePath(second)
|
||||||
|| projectDirectory.absoluteFilePath(first).canonicalPath()
|
|| projectDirectory.resolvePath(first).canonicalPath()
|
||||||
== projectDirectory.absoluteFilePath(second).canonicalPath();
|
== projectDirectory.resolvePath(second).canonicalPath();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Replace path values that do not exist on file system
|
// Replace path values that do not exist on file system
|
||||||
|
@@ -201,12 +201,12 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
|
|||||||
const QList<CMakeBuildTarget> result = transform<QList>(input.targetDetails,
|
const QList<CMakeBuildTarget> result = transform<QList>(input.targetDetails,
|
||||||
[&sourceDir, &sourceDirectory, &buildDirectory,
|
[&sourceDir, &sourceDirectory, &buildDirectory,
|
||||||
&haveLibrariesRelativeToBuildDirectory](const TargetDetails &t) {
|
&haveLibrariesRelativeToBuildDirectory](const TargetDetails &t) {
|
||||||
const FilePath currentBuildDir = buildDirectory.absoluteFilePath(t.buildDir);
|
const FilePath currentBuildDir = buildDirectory.resolvePath(t.buildDir);
|
||||||
|
|
||||||
CMakeBuildTarget ct;
|
CMakeBuildTarget ct;
|
||||||
ct.title = t.name;
|
ct.title = t.name;
|
||||||
if (!t.artifacts.isEmpty())
|
if (!t.artifacts.isEmpty())
|
||||||
ct.executable = buildDirectory.absoluteFilePath(t.artifacts.at(0));
|
ct.executable = buildDirectory.resolvePath(t.artifacts.at(0));
|
||||||
TargetType type = UtilityType;
|
TargetType type = UtilityType;
|
||||||
if (t.type == "EXECUTABLE")
|
if (t.type == "EXECUTABLE")
|
||||||
type = ExecutableType;
|
type = ExecutableType;
|
||||||
@@ -222,7 +222,7 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
|
|||||||
ct.workingDirectory = ct.executable.isEmpty()
|
ct.workingDirectory = ct.executable.isEmpty()
|
||||||
? currentBuildDir.absolutePath()
|
? currentBuildDir.absolutePath()
|
||||||
: ct.executable.parentDir();
|
: ct.executable.parentDir();
|
||||||
ct.sourceDirectory = sourceDirectory.absoluteFilePath(t.sourceDir);
|
ct.sourceDirectory = sourceDirectory.resolvePath(t.sourceDir);
|
||||||
|
|
||||||
ct.backtrace = extractBacktraceInformation(t.backtraceGraph, sourceDir, t.backtrace, 0);
|
ct.backtrace = extractBacktraceInformation(t.backtraceGraph, sourceDir, t.backtrace, 0);
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
const FilePath buildDir = haveLibrariesRelativeToBuildDirectory ? buildDirectory : currentBuildDir;
|
const FilePath buildDir = haveLibrariesRelativeToBuildDirectory ? buildDirectory : currentBuildDir;
|
||||||
FilePath tmp = buildDir.absoluteFilePath(FilePath::fromUserInput(part));
|
FilePath tmp = buildDir.resolvePath(FilePath::fromUserInput(part));
|
||||||
|
|
||||||
if (f.role == "libraries")
|
if (f.role == "libraries")
|
||||||
tmp = tmp.parentDir();
|
tmp = tmp.parentDir();
|
||||||
|
@@ -967,7 +967,7 @@ FilePaths FileApiParser::cmakeQueryFilePaths(const FilePath &buildDirectory)
|
|||||||
{
|
{
|
||||||
FilePath queryDir = buildDirectory / CMAKE_RELATIVE_QUERY_PATH;
|
FilePath queryDir = buildDirectory / CMAKE_RELATIVE_QUERY_PATH;
|
||||||
return transform(CMAKE_QUERY_FILENAMES, [&queryDir](const QString &name) {
|
return transform(CMAKE_QUERY_FILENAMES, [&queryDir](const QString &name) {
|
||||||
return queryDir.absoluteFilePath(FilePath::fromString(name));
|
return queryDir.resolvePath(FilePath::fromString(name));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -251,7 +251,7 @@ FilePath BuildConfiguration::buildDirectory() const
|
|||||||
path = QDir::cleanPath(macroExpander()->expand(path));
|
path = QDir::cleanPath(macroExpander()->expand(path));
|
||||||
|
|
||||||
const FilePath projectDir = target()->project()->projectDirectory();
|
const FilePath projectDir = target()->project()->projectDirectory();
|
||||||
const FilePath buildDir = projectDir.absoluteFilePath(FilePath::fromString(path));
|
const FilePath buildDir = projectDir.resolvePath(FilePath::fromString(path));
|
||||||
|
|
||||||
return mapFromBuildDeviceToGlobalPath(buildDir);
|
return mapFromBuildDeviceToGlobalPath(buildDir);
|
||||||
}
|
}
|
||||||
|
@@ -211,7 +211,7 @@ bool WinRtPackageDeploymentStep::init()
|
|||||||
if (!qt)
|
if (!qt)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const FilePath windeployqtPath = qt->hostBinPath().resolvePath("windeployqt.exe");
|
const FilePath windeployqtPath = qt->hostBinPath().resolvePath(QString("windeployqt.exe"));
|
||||||
|
|
||||||
CommandLine windeployqt{windeployqtPath};
|
CommandLine windeployqt{windeployqtPath};
|
||||||
windeployqt.addArg(QDir::toNativeSeparators(m_targetFilePath));
|
windeployqt.addArg(QDir::toNativeSeparators(m_targetFilePath));
|
||||||
|
Reference in New Issue
Block a user