diff --git a/src/plugins/clangtools/clangselectablefilesdialog.cpp b/src/plugins/clangtools/clangselectablefilesdialog.cpp index 20e1e68098c..7a7dbd9013e 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 3e92f60b678..87757311142 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 77ae1887bdc..f42d3085184 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 178acc62c04..616eb58bbd8 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 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 CMakeTargetNode::visibleAfterAddFileAction() const { - Utils::FileName projFile{filePath()}; - return projFile.appendPath("CMakeLists.txt"); + return filePath().pathAppended("CMakeLists.txt"); } void CMakeTargetNode::setTargetInformation(const QList &artifacts, diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp index 795f2dc7cba..0f348f13e3a 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 64d0594c9db..e63243f887a 100644 --- a/src/plugins/cmakeprojectmanager/servermodereader.cpp +++ b/src/plugins/cmakeprojectmanager/servermodereader.cpp @@ -813,8 +813,7 @@ static void createProjectNode(const QHash &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 QHashsetTargetInformation(t->artifacts, t->type); QList 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 8b83e2797b7..3e3a51d3e2d 100644 --- a/src/plugins/cmakeprojectmanager/tealeafreader.cpp +++ b/src/plugins/cmakeprojectmanager/tealeafreader.cpp @@ -235,8 +235,7 @@ QList 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 b179017cfd8..d10ec35d791 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 98c4579cbae..83ad478b0c6 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 a505bda6e49..b2897d4094e 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 0ebcca588bf..769d83fe517 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 7da92d837d4..a039be62cb1 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(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 063e14d363e..6d40a0acc19 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 50a3d35af4c..0a2d4e3a2b7 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 e03a7e18989..eb7a406051c 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 7316994a801..d78a8091bff 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 00748deafac..63b9175c094 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 4d1fc8e50a3..b5d65a5ccd9 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 49fead9a59e..26ac446028c 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 764ab50269d..6a8a33783de 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 4c1d707309b..95b6fa9e863 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 e1dc23df116..348b810070a 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 CodeStylePool::codeStyles() const diff --git a/src/tools/sdktool/settings.cpp b/src/tools/sdktool/settings.cpp index 3c567afd0ca..f70fefcf2ee 100644 --- a/src/tools/sdktool/settings.cpp +++ b/src/tools/sdktool/settings.cpp @@ -47,11 +47,10 @@ Settings::Settings() : m_instance = this; // autodetect sdk dir: - sdkPath = Utils::FileName::fromString(QCoreApplication::applicationDirPath()); - sdkPath.appendPath(QLatin1String(DATA_PATH)); - sdkPath = Utils::FileName::fromString(QDir::cleanPath(sdkPath.toString())); - sdkPath.appendPath(QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR) - + '/' + Core::Constants::IDE_ID); + sdkPath = Utils::FileName::fromString(QCoreApplication::applicationDirPath()) + .pathAppended(DATA_PATH); + sdkPath = Utils::FileName::fromString(QDir::cleanPath(sdkPath.toString())) + .pathAppended(QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR) + '/' + Core::Constants::IDE_ID); } Utils::FileName Settings::getPath(const QString &file)