summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2021-09-08 16:13:43 +0200
committerhjk <hjk@qt.io>2021-09-09 05:42:30 +0000
commitbdefc13eba4c5b8465db04550f3978db57b5a040 (patch)
treedca8cc7a66f2e153bdc98829394ca5376bf3176a
parentf7489252dff158090ea0873ecde3335a40680ae9 (diff)
downloadqt-creator-bdefc13eba4c5b8465db04550f3978db57b5a040.tar.gz
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>
-rw-r--r--src/libs/utils/filepath.cpp22
-rw-r--r--src/libs/utils/filepath.h4
-rw-r--r--src/libs/utils/qtcprocess.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp8
-rw-r--r--src/plugins/cmakeprojectmanager/fileapidataextractor.cpp8
-rw-r--r--src/plugins/cmakeprojectmanager/fileapiparser.cpp2
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.cpp2
-rw-r--r--src/plugins/winrt/winrtpackagedeploymentstep.cpp2
8 files changed, 25 insertions, 25 deletions
diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp
index 07544638a5..0767542066 100644
--- a/src/libs/utils/filepath.cpp
+++ b/src/libs/utils/filepath.cpp
@@ -381,12 +381,19 @@ bool FilePath::isRelativePath() const
return isRelativePathHelper(m_data, osType());
}
-FilePath FilePath::resolvePath(const QString &fileName) const
+FilePath FilePath::resolvePath(const FilePath &tail) const
{
- if (FileUtils::isAbsolutePath(fileName))
- return FilePath::fromString(QDir::cleanPath(fileName));
+ if (!isRelativePathHelper(tail.m_data, osType()))
+ 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;
- result.setPath(QDir::cleanPath(m_data + '/' + fileName));
+ result.setPath(QDir::cleanPath(m_data + '/' + tail));
return result;
}
@@ -846,13 +853,6 @@ FilePath FilePath::absoluteFilePath() const
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 result = *this;
diff --git a/src/libs/utils/filepath.h b/src/libs/utils/filepath.h
index 18c37170bb..0c9e0e8b94 100644
--- a/src/libs/utils/filepath.h
+++ b/src/libs/utils/filepath.h
@@ -117,7 +117,6 @@ public:
FilePath parentDir() const;
FilePath absolutePath() const;
FilePath absoluteFilePath() const;
- FilePath absoluteFilePath(const FilePath &tail) const;
// makes sure that capitalization of directories is canonical
// on Windows and macOS. This is rarely needed.
@@ -155,7 +154,8 @@ public:
FilePath relativePath(const FilePath &anchor) const;
FilePath pathAppended(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 canonicalPath() const;
diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp
index f807a57c60..bd44b2d823 100644
--- a/src/libs/utils/qtcprocess.cpp
+++ b/src/libs/utils/qtcprocess.cpp
@@ -516,7 +516,7 @@ public:
if (filePath.isAbsolutePath())
return filePath;
- const FilePath fromWorkingDir = workingDir.absoluteFilePath(filePath);
+ const FilePath fromWorkingDir = workingDir.resolvePath(filePath);
if (fromWorkingDir.exists() && fromWorkingDir.isExecutableFile())
return fromWorkingDir;
return filePath.searchInPath();
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
index e7397c033e..c258645dd6 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
@@ -1255,10 +1255,10 @@ void CMakeBuildSystem::updateInitialCMakeExpandableVars()
// this is not 100% correct since CMake resolve them to CMAKE_CURRENT_SOURCE_DIR
// depending on context, but we cannot do better here
return first == second
- || projectDirectory.absoluteFilePath(first)
- == projectDirectory.absoluteFilePath(second)
- || projectDirectory.absoluteFilePath(first).canonicalPath()
- == projectDirectory.absoluteFilePath(second).canonicalPath();
+ || projectDirectory.resolvePath(first)
+ == projectDirectory.resolvePath(second)
+ || projectDirectory.resolvePath(first).canonicalPath()
+ == projectDirectory.resolvePath(second).canonicalPath();
};
// Replace path values that do not exist on file system
diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp
index abdd419a0c..01545b6d69 100644
--- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp
+++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp
@@ -201,12 +201,12 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
const QList<CMakeBuildTarget> result = transform<QList>(input.targetDetails,
[&sourceDir, &sourceDirectory, &buildDirectory,
&haveLibrariesRelativeToBuildDirectory](const TargetDetails &t) {
- const FilePath currentBuildDir = buildDirectory.absoluteFilePath(t.buildDir);
+ const FilePath currentBuildDir = buildDirectory.resolvePath(t.buildDir);
CMakeBuildTarget ct;
ct.title = t.name;
if (!t.artifacts.isEmpty())
- ct.executable = buildDirectory.absoluteFilePath(t.artifacts.at(0));
+ ct.executable = buildDirectory.resolvePath(t.artifacts.at(0));
TargetType type = UtilityType;
if (t.type == "EXECUTABLE")
type = ExecutableType;
@@ -222,7 +222,7 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
ct.workingDirectory = ct.executable.isEmpty()
? currentBuildDir.absolutePath()
: ct.executable.parentDir();
- ct.sourceDirectory = sourceDirectory.absoluteFilePath(t.sourceDir);
+ ct.sourceDirectory = sourceDirectory.resolvePath(t.sourceDir);
ct.backtrace = extractBacktraceInformation(t.backtraceGraph, sourceDir, t.backtrace, 0);
@@ -276,7 +276,7 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
continue;
const FilePath buildDir = haveLibrariesRelativeToBuildDirectory ? buildDirectory : currentBuildDir;
- FilePath tmp = buildDir.absoluteFilePath(FilePath::fromUserInput(part));
+ FilePath tmp = buildDir.resolvePath(FilePath::fromUserInput(part));
if (f.role == "libraries")
tmp = tmp.parentDir();
diff --git a/src/plugins/cmakeprojectmanager/fileapiparser.cpp b/src/plugins/cmakeprojectmanager/fileapiparser.cpp
index dd02e3cc33..1215ef1ff7 100644
--- a/src/plugins/cmakeprojectmanager/fileapiparser.cpp
+++ b/src/plugins/cmakeprojectmanager/fileapiparser.cpp
@@ -967,7 +967,7 @@ FilePaths FileApiParser::cmakeQueryFilePaths(const FilePath &buildDirectory)
{
FilePath queryDir = buildDirectory / CMAKE_RELATIVE_QUERY_PATH;
return transform(CMAKE_QUERY_FILENAMES, [&queryDir](const QString &name) {
- return queryDir.absoluteFilePath(FilePath::fromString(name));
+ return queryDir.resolvePath(FilePath::fromString(name));
});
}
diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp
index e66d5ac076..905900cd43 100644
--- a/src/plugins/projectexplorer/buildconfiguration.cpp
+++ b/src/plugins/projectexplorer/buildconfiguration.cpp
@@ -251,7 +251,7 @@ FilePath BuildConfiguration::buildDirectory() const
path = QDir::cleanPath(macroExpander()->expand(path));
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);
}
diff --git a/src/plugins/winrt/winrtpackagedeploymentstep.cpp b/src/plugins/winrt/winrtpackagedeploymentstep.cpp
index a84ba3a5e8..8335aae39d 100644
--- a/src/plugins/winrt/winrtpackagedeploymentstep.cpp
+++ b/src/plugins/winrt/winrtpackagedeploymentstep.cpp
@@ -211,7 +211,7 @@ bool WinRtPackageDeploymentStep::init()
if (!qt)
return false;
- const FilePath windeployqtPath = qt->hostBinPath().resolvePath("windeployqt.exe");
+ const FilePath windeployqtPath = qt->hostBinPath().resolvePath(QString("windeployqt.exe"));
CommandLine windeployqt{windeployqtPath};
windeployqt.addArg(QDir::toNativeSeparators(m_targetFilePath));