Utils: Rename FileName to FilePath

More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-05-28 13:49:26 +02:00
parent 4704f49fbb
commit 473a741c9f
688 changed files with 3487 additions and 3484 deletions

View File

@@ -120,7 +120,7 @@ static QList<QmakeProject *> s_projects;
QmakeProject manages information about an individual Qt 4 (.pro) project file.
*/
QmakeProject::QmakeProject(const FileName &fileName) :
QmakeProject::QmakeProject(const FilePath &fileName) :
Project(QmakeProjectManager::Constants::PROFILE_MIMETYPE, fileName),
m_qmakeVfs(new QMakeVfs),
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater)
@@ -269,7 +269,7 @@ void QmakeProject::updateCppCodeModel()
QStringList fileList = pro->variableValue(Variable::ExactSource) + cumulativeSourceFiles;
QList<ProjectExplorer::ExtraCompiler *> proGenerators = pro->extraCompilers();
foreach (ProjectExplorer::ExtraCompiler *ec, proGenerators) {
ec->forEachTarget([&](const Utils::FileName &generatedFile) {
ec->forEachTarget([&](const Utils::FilePath &generatedFile) {
fileList += generatedFile.toString();
});
}
@@ -305,7 +305,7 @@ void QmakeProject::updateQmlJSCodeModel()
bool hasQmlLib = false;
for (QmakeProFile *file : proFiles) {
for (const QString &path : file->variableValue(Variable::QmlImportPath)) {
projectInfo.importPaths.maybeInsert(FileName::fromString(path),
projectInfo.importPaths.maybeInsert(FilePath::fromString(path),
QmlJS::Dialect::Qml);
}
const QStringList &exactResources = file->variableValue(Variable::ExactResource);
@@ -553,7 +553,7 @@ Tasks QmakeProject::projectIssues(const Kit *k) const
}
// Find the folder that contains a file with a certain name (recurse down)
static FolderNode *folderOf(FolderNode *in, const FileName &fileName)
static FolderNode *folderOf(FolderNode *in, const FilePath &fileName)
{
foreach (FileNode *fn, in->fileNodes())
if (fn->filePath() == fileName)
@@ -566,7 +566,7 @@ static FolderNode *folderOf(FolderNode *in, const FileName &fileName)
// Find the QmakeProFileNode that contains a certain file.
// First recurse down to folder, then find the pro-file.
static FileNode *fileNodeOf(FolderNode *in, const FileName &fileName)
static FileNode *fileNodeOf(FolderNode *in, const FilePath &fileName)
{
for (FolderNode *folder = folderOf(in, fileName); folder; folder = folder->parentFolderNode()) {
if (auto *proFile = dynamic_cast<QmakeProFileNode *>(folder)) {
@@ -584,13 +584,13 @@ QStringList QmakeProject::filesGeneratedFrom(const QString &input) const
if (!rootProjectNode())
return { };
if (const FileNode *file = fileNodeOf(rootProjectNode(), FileName::fromString(input))) {
if (const FileNode *file = fileNodeOf(rootProjectNode(), FilePath::fromString(input))) {
const QmakeProFileNode *pro = static_cast<QmakeProFileNode *>(file->parentFolderNode());
QTC_ASSERT(pro, return {});
if (const QmakeProFile *proFile = pro->proFile())
return Utils::transform(proFile->generatedFiles(FileName::fromString(pro->buildDir()),
return Utils::transform(proFile->generatedFiles(FilePath::fromString(pro->buildDir()),
file->filePath(), file->fileType()),
&FileName::toString);
&FilePath::toString);
}
return { };
}
@@ -731,7 +731,7 @@ void QmakeProject::setAllBuildConfigurationsEnabled(bool enabled)
}
}
static void notifyChangedHelper(const FileName &fileName, QmakeProFile *file)
static void notifyChangedHelper(const FilePath &fileName, QmakeProFile *file)
{
if (file->filePath() == fileName) {
QtSupport::ProFileCacheManager::instance()->discardFile(
@@ -745,7 +745,7 @@ static void notifyChangedHelper(const FileName &fileName, QmakeProFile *file)
}
}
void QmakeProject::notifyChanged(const FileName &name)
void QmakeProject::notifyChanged(const FilePath &name)
{
for (QmakeProject *project : s_projects) {
if (project->files(QmakeProject::SourceFiles).contains(name))
@@ -882,7 +882,7 @@ void CentralizedFolderWatcher::delayedFolderChanged(const QString &folder)
QList<QmakePriFile *> files = m_map.values(dir);
if (!files.isEmpty()) {
// Collect all the files
QSet<FileName> newFiles;
QSet<FilePath> newFiles;
newFiles += QmakePriFile::recursiveEnumerate(folder);
foreach (QmakePriFile *file, files)
newOrRemovedFiles = newOrRemovedFiles || file->folderChanged(folder, newFiles);
@@ -986,11 +986,11 @@ void QmakeProject::updateBuildSystemData()
workingDir += '/' + ti.target + ".app/Contents/MacOS";
BuildTargetInfo bti;
bti.targetFilePath = FileName::fromString(executableFor(node->proFile()));
bti.targetFilePath = FilePath::fromString(executableFor(node->proFile()));
bti.projectFilePath = node->filePath();
bti.workingDirectory = FileName::fromString(workingDir);
bti.workingDirectory = FilePath::fromString(workingDir);
bti.displayName = bti.projectFilePath.toFileInfo().completeBaseName();
const FileName relativePathInProject
const FilePath relativePathInProject
= bti.projectFilePath.relativeChildPath(projectDirectory());
if (!relativePathInProject.isEmpty()) {
bti.displayNameUniquifier = QString::fromLatin1(" (%1)")
@@ -1080,12 +1080,12 @@ void QmakeProject::collectApplicationData(const QmakeProFile *file, DeploymentDa
DeployableFile::TypeExecutable);
}
static FileName destDirFor(const TargetInformation &ti)
static FilePath destDirFor(const TargetInformation &ti)
{
if (ti.destDir.isEmpty())
return ti.buildDir;
if (QDir::isRelativePath(ti.destDir.toString()))
return FileName::fromString(QDir::cleanPath(ti.buildDir.toString() + '/' + ti.destDir.toString()));
return FilePath::fromString(QDir::cleanPath(ti.buildDir.toString() + '/' + ti.destDir.toString()));
return ti.destDir;
}
@@ -1122,7 +1122,7 @@ void QmakeProject::collectLibraryData(const QmakeProFile *file, DeploymentData &
break;
}
case Abi::DarwinOS: {
FileName destDir = destDirFor(ti);
FilePath destDir = destDirFor(ti);
if (config.contains(QLatin1String("lib_bundle"))) {
destDir = destDir.pathAppended(ti.target + ".framework");
} else {
@@ -1181,7 +1181,7 @@ void QmakeProject::collectLibraryData(const QmakeProFile *file, DeploymentData &
bool QmakeProject::matchesKit(const Kit *kit)
{
FileName filePath = projectFilePath();
FilePath filePath = projectFilePath();
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(kit);
return QtSupport::QtVersionManager::version([&filePath, version](const QtSupport::BaseQtVersion *v) {
@@ -1189,7 +1189,7 @@ bool QmakeProject::matchesKit(const Kit *kit)
});
}
static Utils::FileName getFullPathOf(const QmakeProFile *pro, Variable variable,
static Utils::FilePath getFullPathOf(const QmakeProFile *pro, Variable variable,
const BuildConfiguration *bc)
{
// Take last non-flag value, to cover e.g. '@echo $< && $$QMAKE_CC' or 'ccache gcc'
@@ -1198,22 +1198,22 @@ static Utils::FileName getFullPathOf(const QmakeProFile *pro, Variable variable,
return !value.startsWith('-');
});
if (values.isEmpty())
return Utils::FileName();
return Utils::FilePath();
const QString exe = values.last();
QTC_ASSERT(bc, return Utils::FileName::fromString(exe));
QTC_ASSERT(bc, return Utils::FilePath::fromString(exe));
QFileInfo fi(exe);
if (fi.isAbsolute())
return Utils::FileName::fromString(exe);
return Utils::FilePath::fromString(exe);
return bc->environment().searchInPath(exe);
}
void QmakeProject::testToolChain(ToolChain *tc, const Utils::FileName &path) const
void QmakeProject::testToolChain(ToolChain *tc, const Utils::FilePath &path) const
{
if (!tc || path.isEmpty())
return;
const Utils::FileName expected = tc->compilerCommand();
const Utils::FilePath expected = tc->compilerCommand();
Environment env = Environment::systemEnvironment();
Kit *k = nullptr;
@@ -1228,7 +1228,7 @@ void QmakeProject::testToolChain(ToolChain *tc, const Utils::FileName &path) con
if (env.isSameExecutable(path.toString(), expected.toString()))
return;
const QPair<Utils::FileName, Utils::FileName> pair = qMakePair(expected, path);
const QPair<Utils::FilePath, Utils::FilePath> pair = qMakePair(expected, path);
if (m_toolChainWarnings.contains(pair))
return;
// Suppress warnings on Apple machines where compilers in /usr/bin point into Xcode.
@@ -1246,7 +1246,7 @@ void QmakeProject::testToolChain(ToolChain *tc, const Utils::FileName &path) con
"Please update your kit (%3) or choose a mkspec for qmake that matches "
"your target environment better.")
.arg(path.toUserOutput()).arg(expected.toUserOutput()).arg(k->displayName()),
Utils::FileName(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
m_toolChainWarnings.insert(pair);
}
@@ -1305,7 +1305,7 @@ QmakeProject::AsyncUpdateState QmakeProject::asyncUpdateState() const
return m_asyncUpdateState;
}
QString QmakeProject::mapProFilePathToTarget(const FileName &proFilePath)
QString QmakeProject::mapProFilePathToTarget(const FilePath &proFilePath)
{
const QmakeProFile *pro = rootProFile()->findProFile(proFilePath);
return pro ? pro->targetInformation().target : QString();