forked from qt-creator/qt-creator
More FileName::appendPath() -> .pathAppended()
Change-Id: I403d34e4f52f758339c158efc7a11fd329e3e043 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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});
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user