diff options
author | hjk <hjk@qt.io> | 2019-05-17 12:32:05 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-05-17 11:55:04 +0000 |
commit | f4c9e5e5c4b7f61d28e34c1912965c0e27d3b0e6 (patch) | |
tree | 18f296e0ca70bb0a6ac9428b9dceee43ca8d0131 /src/plugins | |
parent | 0565457b5c16564d2b230dca8eea6d94024efae2 (diff) | |
download | qt-creator-f4c9e5e5c4b7f61d28e34c1912965c0e27d3b0e6.tar.gz |
More FileName::appendPath() -> .pathAppended()
Change-Id: I403d34e4f52f758339c158efc7a11fd329e3e043
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins')
22 files changed, 35 insertions, 53 deletions
diff --git a/src/plugins/clangtools/clangselectablefilesdialog.cpp b/src/plugins/clangtools/clangselectablefilesdialog.cpp index 20e1e68098..7a7dbd9013 100644 --- a/src/plugins/clangtools/clangselectablefilesdialog.cpp +++ b/src/plugins/clangtools/clangselectablefilesdialog.cpp @@ -248,7 +248,7 @@ private: // Create needed extra dir nodes FileName currentDirPath = parentDir; for (const QString &dirName : dirsToCreate) { - currentDirPath.appendPath(dirName); + currentDirPath = currentDirPath.pathAppended(dirName); Tree *newDirNode = createDirNode(dirName, currentDirPath); linkDirNode(parentNode, newDirNode); diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 3e92f60b67..8775731114 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -276,7 +276,8 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc) { CMakeConfigItem settingFileItem; settingFileItem.key = "ANDROID_DEPLOYMENT_SETTINGS_FILE"; - settingFileItem.value = bc->buildDirectory().appendPath("android_deployment_settings.json").toString().toUtf8(); + settingFileItem.value = bc->buildDirectory() + .pathAppended("android_deployment_settings.json").toString().toUtf8(); patchedConfig.append(settingFileItem); } diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp index 77ae1887bd..f42d308518 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp @@ -207,9 +207,7 @@ static Utils::FileName qmakeFromCMakeCache(const CMakeConfig &config) // Eat the leading "}/" and trailing " const QByteArray locationPart = origLine.mid(sp + 2, ep - 2 - sp); - Utils::FileName result = baseQtDir; - result.appendPath(QString::fromUtf8(locationPart)); - return result; + return baseQtDir.pathAppended(QString::fromUtf8(locationPart)); } } } diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp index 178acc62c0..616eb58bbd 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp @@ -144,8 +144,7 @@ bool CMakeListsNode::supportsAction(ProjectExplorer::ProjectAction action, const Utils::optional<Utils::FileName> CMakeListsNode::visibleAfterAddFileAction() const { - Utils::FileName projFile{filePath()}; - return projFile.appendPath("CMakeLists.txt"); + return filePath().pathAppended("CMakeLists.txt"); } CMakeProjectNode::CMakeProjectNode(const Utils::FileName &directory) : @@ -251,8 +250,7 @@ bool CMakeTargetNode::addFiles(const QStringList &filePaths, QStringList *) Utils::optional<Utils::FileName> CMakeTargetNode::visibleAfterAddFileAction() const { - Utils::FileName projFile{filePath()}; - return projFile.appendPath("CMakeLists.txt"); + return filePath().pathAppended("CMakeLists.txt"); } void CMakeTargetNode::setTargetInformation(const QList<Utils::FileName> &artifacts, diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp index 795f2dc7cb..0f348f13e3 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketool.cpp @@ -190,8 +190,7 @@ QVariantMap CMakeTool::toMap() const Utils::FileName CMakeTool::cmakeExecutable() const { if (Utils::HostOsInfo::isMacHost() && m_executable.endsWith(".app")) { - Utils::FileName toTest = m_executable; - toTest = toTest.appendPath("Contents/bin/cmake"); + const Utils::FileName toTest = m_executable.pathAppended("Contents/bin/cmake"); if (toTest.exists()) return toTest; } diff --git a/src/plugins/cmakeprojectmanager/servermodereader.cpp b/src/plugins/cmakeprojectmanager/servermodereader.cpp index 64d0594c9d..e63243f887 100644 --- a/src/plugins/cmakeprojectmanager/servermodereader.cpp +++ b/src/plugins/cmakeprojectmanager/servermodereader.cpp @@ -813,8 +813,7 @@ static void createProjectNode(const QHash<Utils::FileName, ProjectNode *> &cmake ProjectNode *cmln = cmakeListsNodes.value(dir); QTC_ASSERT(cmln, qDebug() << dir.toUserOutput(); return); - Utils::FileName projectName = dir; - projectName.appendPath(".project::" + displayName); + const Utils::FileName projectName = dir.pathAppended(".project::" + displayName); ProjectNode *pn = cmln->projectNode(projectName); if (!pn) { @@ -865,8 +864,7 @@ void ServerModeReader::addTargets(const QHash<Utils::FileName, ProjectExplorer:: tNode->setTargetInformation(t->artifacts, t->type); QList<FolderNode::LocationInfo> info; // Set up a default target path: - FileName targetPath = t->sourceDirectory; - targetPath.appendPath("CMakeLists.txt"); + FileName targetPath = t->sourceDirectory.pathAppended("CMakeLists.txt"); for (CrossReference *cr : qAsConst(t->crossReferences)) { BacktraceItem *bt = cr->backtrace.isEmpty() ? nullptr : cr->backtrace.at(0); if (bt) { diff --git a/src/plugins/cmakeprojectmanager/tealeafreader.cpp b/src/plugins/cmakeprojectmanager/tealeafreader.cpp index 8b83e2797b..3e3a51d3e2 100644 --- a/src/plugins/cmakeprojectmanager/tealeafreader.cpp +++ b/src/plugins/cmakeprojectmanager/tealeafreader.cpp @@ -235,8 +235,7 @@ QList<CMakeBuildTarget> TeaLeafReader::takeBuildTargets() CMakeConfig TeaLeafReader::takeParsedConfiguration() { - FileName cacheFile = m_parameters.workDirectory; - cacheFile.appendPath(QLatin1String("CMakeCache.txt")); + const FileName cacheFile = m_parameters.workDirectory.pathAppended("CMakeCache.txt"); if (!cacheFile.exists()) return { }; @@ -432,8 +431,7 @@ void TeaLeafReader::extractData() m_cmakeFiles.insert(cbpFile); // Add CMakeCache.txt file: - FileName cacheFile = m_parameters.workDirectory; - cacheFile.appendPath(QLatin1String("CMakeCache.txt")); + const FileName cacheFile = m_parameters.workDirectory.pathAppended("CMakeCache.txt"); if (cacheFile.toFileInfo().exists()) m_cmakeFiles.insert(cacheFile); diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp index b179017cfd..d10ec35d79 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp @@ -475,14 +475,11 @@ void CompilationDatabaseProject::buildTreeAndProjectParts(const Utils::FileName } if (!extras.empty()) { - const QString baseDir = projectFile.parentDir().toString(); + const Utils::FileName baseDir = projectFile.parentDir(); QStringList extraFiles; - for (const QString &extra : extras) { - auto extraFile = Utils::FileName::fromString(baseDir); - extraFile.appendPath(extra); - extraFiles.append(extraFile.toString()); - } + for (const QString &extra : extras) + extraFiles.append(baseDir.pathAppended(extra).toString()); CppTools::RawProjectPart rppExtra; rppExtra.setFiles(extraFiles); diff --git a/src/plugins/cpptools/headerpathfilter.cpp b/src/plugins/cpptools/headerpathfilter.cpp index 98c4579cba..83ad478b0c 100644 --- a/src/plugins/cpptools/headerpathfilter.cpp +++ b/src/plugins/cpptools/headerpathfilter.cpp @@ -148,9 +148,8 @@ void HeaderPathFilter::tweakHeaderPaths() void HeaderPathFilter::addPreIncludesPath() { if (projectDirectory.size()) { - Utils::FileName rootProjectDirectory = Utils::FileName::fromString(projectDirectory); - - rootProjectDirectory.appendPath(".pre_includes"); + const Utils::FileName rootProjectDirectory = Utils::FileName::fromString(projectDirectory) + .pathAppended(".pre_includes"); systemHeaderPaths.push_back( {rootProjectDirectory.toString(), ProjectExplorer::HeaderPathType::System}); diff --git a/src/plugins/git/gerrit/gerritparameters.cpp b/src/plugins/git/gerrit/gerritparameters.cpp index a505bda6e4..b2897d4094 100644 --- a/src/plugins/git/gerrit/gerritparameters.cpp +++ b/src/plugins/git/gerrit/gerritparameters.cpp @@ -60,8 +60,7 @@ static inline QString detectApp(const char *defaultExe) const FileName gitBinDir = GerritPlugin::gitBinDirectory(); if (gitBinDir.isEmpty()) return QString(); - FileName path = gitBinDir; - path.appendPath(defaultApp); + FileName path = gitBinDir.pathAppended(defaultApp); if (path.exists()) return path.toString(); @@ -74,7 +73,7 @@ static inline QString detectApp(const char *defaultExe) const QStringList entries = dir.entryList({"mingw*"}); if (entries.isEmpty()) return QString(); - path.appendPath(entries.first()).appendPath("bin").appendPath(defaultApp); + path = path.pathAppended(entries.first()).pathAppended("bin").pathAppended(defaultApp); if (path.exists()) return path.toString(); return QString(); diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp index 0ebcca588b..769d83fe51 100644 --- a/src/plugins/projectexplorer/projectnodes.cpp +++ b/src/plugins/projectexplorer/projectnodes.cpp @@ -89,7 +89,7 @@ static FolderNode *recursiveFindOrCreateFolderNode(FolderNode *folder, ProjectExplorer::FolderNode *parent = folder; foreach (const QString &part, parts) { - path.appendPath(part); + path = path.pathAppended(part); // Find folder in subFolders FolderNode *next = folderNode(parent, path); if (!next) { diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 7da92d837d..a039be62cb 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -266,8 +266,8 @@ Utils::FileName QbsBuildStep::installRoot(VariableHandling variableHandling) con const QbsBuildConfiguration * const bc = static_cast<QbsBuildConfiguration *>(buildConfiguration()); - return bc->buildDirectory().appendPath(bc->configurationName()) - .appendPath(qbs::InstallOptions::defaultInstallRoot()); + return bc->buildDirectory().pathAppended(bc->configurationName()) + .pathAppended(qbs::InstallOptions::defaultInstallRoot()); } int QbsBuildStep::maxJobs() const diff --git a/src/plugins/qbsprojectmanager/qbsprojectimporter.cpp b/src/plugins/qbsprojectmanager/qbsprojectimporter.cpp index 063e14d363..6d40a0acc1 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectimporter.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectimporter.cpp @@ -203,8 +203,7 @@ Kit *QbsProjectImporter::createKit(void *directoryData) const qCDebug(qbsPmLog) << "creating kit for imported build" << bgData->bgFilePath.toUserOutput(); QtVersionData qtVersionData; if (!bgData->qtBinPath.isEmpty()) { - FileName qmakeFilePath = bgData->qtBinPath; - qmakeFilePath.appendPath(HostOsInfo::withExecutableSuffix("qmake")); + const FileName qmakeFilePath = bgData->qtBinPath.pathAppended(HostOsInfo::withExecutableSuffix("qmake")); qtVersionData = findOrCreateQtVersion(qmakeFilePath); } return createTemporaryKit(qtVersionData,[this, bgData](Kit *k) -> void { diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp index 50a3d35af4..0a2d4e3a2b 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp @@ -1942,15 +1942,14 @@ FileNameList QmakeProFile::generatedFiles(const FileName &buildDir, location = buildDir; if (location.isEmpty()) return { }; - location.appendPath(QLatin1String("ui_") - + sourceFile.toFileInfo().completeBaseName() - + singleVariableValue(Variable::HeaderExtension)); + location = location.pathAppended("ui_" + + sourceFile.toFileInfo().completeBaseName() + + singleVariableValue(Variable::HeaderExtension)); return { Utils::FileName::fromString(QDir::cleanPath(location.toString())) }; } else if (sourceFileType == FileType::StateChart) { if (buildDir.isEmpty()) return { }; - FileName location = buildDir; - location.appendPath(sourceFile.toFileInfo().completeBaseName()); + const FileName location = buildDir.pathAppended(sourceFile.toFileInfo().completeBaseName()); return { location.stringAppended(singleVariableValue(Variable::HeaderExtension)), location.stringAppended(singleVariableValue(Variable::CppExtension)) diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index e03a7e1898..eb7a406051 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -1123,7 +1123,7 @@ void QmakeProject::collectLibraryData(const QmakeProFile *file, DeploymentData & case Abi::DarwinOS: { FileName destDir = destDirFor(ti); if (config.contains(QLatin1String("lib_bundle"))) { - destDir.appendPath(ti.target + ".framework"); + destDir = destDir.pathAppended(ti.target + ".framework"); } else { if (!(isPlugin && config.contains(QLatin1String("no_plugin_name_prefix")))) targetFileName.prepend(QLatin1String("lib")); diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 7316994a80..d78a8091bf 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -469,7 +469,7 @@ FileNameList BaseQtVersion::directoriesToIgnoreInProjectTree() const FileName mkspecPathSrc = FileName::fromUserInput(qmakeProperty("QT_HOST_DATA", PropertyVariantSrc)); if (!mkspecPathSrc.isEmpty()) { - mkspecPathSrc.appendPath("mkspecs"); + mkspecPathSrc = mkspecPathSrc.pathAppended("mkspecs"); if (mkspecPathSrc != mkspecPathGet) result.append(mkspecPathSrc); } diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp index 00748deafa..63b9175c09 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp @@ -159,8 +159,8 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI it->replace(projectDir, targetDir); foreach (const QString &dependency, dependencies) { - FileName targetFile = FileName::fromString(targetDir); - targetFile.appendPath(QDir(dependency).dirName()); + const FileName targetFile = FileName::fromString(targetDir) + .pathAppended(QDir(dependency).dirName()); if (!FileUtils::copyRecursively(FileName::fromString(dependency), targetFile, &error)) { QMessageBox::warning(ICore::mainWindow(), tr("Cannot Copy Project"), error); diff --git a/src/plugins/qtsupport/qscxmlcgenerator.cpp b/src/plugins/qtsupport/qscxmlcgenerator.cpp index 4d1fc8e50a..b5d65a5ccd 100644 --- a/src/plugins/qtsupport/qscxmlcgenerator.cpp +++ b/src/plugins/qtsupport/qscxmlcgenerator.cpp @@ -118,8 +118,7 @@ FileNameToContentsHash QScxmlcGenerator::handleProcessFinished(QProcess *process const Utils::FileName wd = workingDirectory(); FileNameToContentsHash result; forEachTarget([&](const Utils::FileName &target) { - Utils::FileName file = wd; - file.appendPath(target.fileName()); + const Utils::FileName file = wd.pathAppended(target.fileName()); QFile generated(file.toString()); if (!generated.open(QIODevice::ReadOnly)) return; diff --git a/src/plugins/remotelinux/tarpackagecreationstep.cpp b/src/plugins/remotelinux/tarpackagecreationstep.cpp index 49fead9a59..26ac446028 100644 --- a/src/plugins/remotelinux/tarpackagecreationstep.cpp +++ b/src/plugins/remotelinux/tarpackagecreationstep.cpp @@ -119,7 +119,7 @@ void TarPackageCreationStep::addNeededDeploymentFiles( } for (const QString &fileName : files) { - const QString localFilePath = deployable.localFilePath().appendPath(fileName).toString(); + const QString localFilePath = deployable.localFilePath().pathAppended(fileName).toString(); const QString remoteDir = deployable.remoteDirectory() + '/' + fileInfo.fileName(); diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp index 764ab50269..6a8a33783d 100644 --- a/src/plugins/resourceeditor/resourcenode.cpp +++ b/src/plugins/resourceeditor/resourcenode.cpp @@ -462,7 +462,7 @@ bool ResourceTopLevelNode::showInSimpleTree() const } ResourceFolderNode::ResourceFolderNode(const QString &prefix, const QString &lang, ResourceTopLevelNode *parent) - : FolderNode(FileName(parent->filePath()).appendPath(prefix)), + : FolderNode(parent->filePath().pathAppended(prefix)), // TOOD Why add existing directory doesn't work m_topLevelNode(parent), m_prefix(prefix), diff --git a/src/plugins/tasklist/tasklistplugin.cpp b/src/plugins/tasklist/tasklistplugin.cpp index 4c1d707309..95b6fa9e86 100644 --- a/src/plugins/tasklist/tasklistplugin.cpp +++ b/src/plugins/tasklist/tasklistplugin.cpp @@ -149,7 +149,7 @@ static bool parseTaskFile(QString *errorString, const FileName &name) file = QDir::fromNativeSeparators(file); QFileInfo fi(file); if (fi.isRelative()) - file = FileName(parentDir).appendPath(file).toString(); + file = parentDir.pathAppended(file).toString(); } description = unescape(description); diff --git a/src/plugins/texteditor/codestylepool.cpp b/src/plugins/texteditor/codestylepool.cpp index e1dc23df11..348b810070 100644 --- a/src/plugins/texteditor/codestylepool.cpp +++ b/src/plugins/texteditor/codestylepool.cpp @@ -119,9 +119,7 @@ QString CodeStylePool::settingsDir() const Utils::FileName CodeStylePool::settingsPath(const QByteArray &id) const { - Utils::FileName path = Utils::FileName::fromString(settingsDir()); - path.appendPath(QString::fromUtf8(id + ".xml")); - return path; + return Utils::FileName::fromString(settingsDir()).pathAppended(QString::fromUtf8(id + ".xml")); } QList<ICodeStylePreferences *> CodeStylePool::codeStyles() const |