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

@@ -62,9 +62,9 @@ namespace Internal {
BuildDirManager::BuildDirManager() = default;
BuildDirManager::~BuildDirManager() = default;
Utils::FileName BuildDirManager::workDirectory(const BuildDirParameters &parameters) const
Utils::FilePath BuildDirManager::workDirectory(const BuildDirParameters &parameters) const
{
const Utils::FileName bdir = parameters.buildDirectory;
const Utils::FilePath bdir = parameters.buildDirectory;
const CMakeTool *cmake = parameters.cmakeTool();
if (bdir.exists()) {
m_buildDirToTempDir.erase(bdir);
@@ -88,7 +88,7 @@ Utils::FileName BuildDirManager::workDirectory(const BuildDirParameters &paramet
return bdir;
}
}
return Utils::FileName::fromString(tmpDirIt->second->path());
return Utils::FilePath::fromString(tmpDirIt->second->path());
}
void BuildDirManager::emitDataAvailable()
@@ -261,7 +261,7 @@ bool BuildDirManager::persistCMakeState()
if (m_parameters.workDirectory == m_parameters.buildDirectory)
return false;
const Utils::FileName buildDir = m_parameters.buildDirectory;
const Utils::FilePath buildDir = m_parameters.buildDirectory;
QDir dir(buildDir.toString());
dir.mkpath(buildDir.toString());
@@ -311,8 +311,8 @@ void BuildDirManager::clearCache()
QTC_ASSERT(m_parameters.isValid(), return);
QTC_ASSERT(!m_isHandlingError, return);
const FileName cmakeCache = m_parameters.workDirectory.pathAppended("CMakeCache.txt");
const FileName cmakeFiles = m_parameters.workDirectory.pathAppended("CMakeFiles");
const FilePath cmakeCache = m_parameters.workDirectory.pathAppended("CMakeCache.txt");
const FilePath cmakeFiles = m_parameters.workDirectory.pathAppended("CMakeFiles");
const bool mustCleanUp = cmakeCache.exists() || cmakeFiles.exists();
if (!mustCleanUp)
@@ -367,7 +367,7 @@ CMakeConfig BuildDirManager::takeCMakeConfiguration() const
return result;
}
CMakeConfig BuildDirManager::parseCMakeConfiguration(const Utils::FileName &cacheFile,
CMakeConfig BuildDirManager::parseCMakeConfiguration(const Utils::FilePath &cacheFile,
QString *errorMessage)
{
if (!cacheFile.exists()) {

View File

@@ -81,7 +81,7 @@ public:
QList<CMakeBuildTarget> takeBuildTargets() const;
CMakeConfig takeCMakeConfiguration() const;
static CMakeConfig parseCMakeConfiguration(const Utils::FileName &cacheFile,
static CMakeConfig parseCMakeConfiguration(const Utils::FilePath &cacheFile,
QString *errorMessage);
enum ReparseParameters { REPARSE_DEFAULT = 0, // use defaults
@@ -104,7 +104,7 @@ private:
void emitErrorOccured(const QString &message) const;
bool checkConfiguration();
Utils::FileName workDirectory(const BuildDirParameters &parameters) const;
Utils::FilePath workDirectory(const BuildDirParameters &parameters) const;
void updateReaderType(const BuildDirParameters &p, std::function<void()> todo);
@@ -114,7 +114,7 @@ private:
void becameDirty();
BuildDirParameters m_parameters;
mutable std::unordered_map<Utils::FileName, std::unique_ptr<Utils::TemporaryDirectory>> m_buildDirToTempDir;
mutable std::unordered_map<Utils::FilePath, std::unique_ptr<Utils::TemporaryDirectory>> m_buildDirToTempDir;
mutable std::unique_ptr<BuildDirReader> m_reader;
mutable bool m_isHandlingError = false;
};

View File

@@ -52,16 +52,16 @@ public:
CMakeBuildConfiguration *buildConfiguration = nullptr;
QString projectName;
Utils::FileName sourceDirectory;
Utils::FileName buildDirectory;
Utils::FileName workDirectory; // either buildDirectory or a QTemporaryDirectory!
Utils::FilePath sourceDirectory;
Utils::FilePath buildDirectory;
Utils::FilePath workDirectory; // either buildDirectory or a QTemporaryDirectory!
Utils::Environment environment;
Core::Id cmakeToolId;
QByteArray cxxToolChainId;
QByteArray cToolChainId;
Utils::FileName sysRoot;
Utils::FilePath sysRoot;
Utils::MacroExpander *expander = nullptr;

View File

@@ -101,7 +101,7 @@ void CMakeBuildConfiguration::initialize(const BuildInfo &info)
CMakeProjectManager::CMakeConfigItem::Type::STRING,
"Android native API level",
bs->data(Android::Constants::AndroidNdkPlatform).toString().toUtf8()});
auto ndkLocation = bs->data(Android::Constants::NdkLocation).value<FileName>();
auto ndkLocation = bs->data(Android::Constants::NdkLocation).value<FilePath>();
m_initialConfiguration.prepend(CMakeProjectManager::CMakeConfigItem{"ANDROID_NDK",
CMakeProjectManager::CMakeConfigItem::Type::PATH,
"Android NDK PATH",
@@ -258,20 +258,20 @@ const QList<CMakeBuildTarget> &CMakeBuildConfiguration::buildTargets() const
return m_buildTargets;
}
FileName CMakeBuildConfiguration::shadowBuildDirectory(const FileName &projectFilePath,
FilePath CMakeBuildConfiguration::shadowBuildDirectory(const FilePath &projectFilePath,
const Kit *k,
const QString &bcName,
BuildConfiguration::BuildType buildType)
{
if (projectFilePath.isEmpty())
return FileName();
return FilePath();
const QString projectName = projectFilePath.parentDir().fileName();
ProjectMacroExpander expander(projectFilePath.toString(), projectName, k, bcName, buildType);
QDir projectDir = QDir(Project::projectDirectory(projectFilePath).toString());
QString buildPath = expander.expand(ProjectExplorerPlugin::buildDirectoryTemplate());
buildPath.replace(" ", "-");
return FileName::fromUserInput(projectDir.absoluteFilePath(buildPath));
return FilePath::fromUserInput(projectDir.absoluteFilePath(buildPath));
}
void CMakeBuildConfiguration::buildTarget(const QString &buildTarget)
@@ -496,7 +496,7 @@ QList<BuildInfo> CMakeBuildConfigurationFactory::availableBuilds(const Target *p
QList<BuildInfo> CMakeBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
{
QList<BuildInfo> result;
const FileName projectPathName = FileName::fromString(projectPath);
const FilePath projectPathName = FilePath::fromString(projectPath);
for (int type = BuildTypeDebug; type != BuildTypeLast; ++type) {
BuildInfo info = createBuildInfo(k,
ProjectExplorer::Project::projectDirectory(projectPathName).toString(),

View File

@@ -67,8 +67,8 @@ public:
const QList<ProjectExplorer::BuildTargetInfo> appTargets() const;
ProjectExplorer::DeploymentData deploymentData() const;
static Utils::FileName
shadowBuildDirectory(const Utils::FileName &projectFilePath, const ProjectExplorer::Kit *k,
static Utils::FilePath
shadowBuildDirectory(const Utils::FilePath &projectFilePath, const ProjectExplorer::Kit *k,
const QString &bcName, BuildConfiguration::BuildType buildType);
// Context menu action:

View File

@@ -111,7 +111,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
connect(buildDirChooser, &Utils::PathChooser::rawPathChanged, this,
[this](const QString &path) {
m_configModel->flush(); // clear out config cache...
m_buildConfiguration->setBuildDirectory(Utils::FileName::fromString(path));
m_buildConfiguration->setBuildDirectory(Utils::FilePath::fromString(path));
});
int row = 0;

View File

@@ -160,7 +160,7 @@ bool CMakeBuildStep::init()
emit addTask(Task(Task::Error,
QCoreApplication::translate("CMakeProjectManager::CMakeBuildStep",
"The build configuration is currently disabled."),
Utils::FileName(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
canInit = false;
}
@@ -169,7 +169,7 @@ bool CMakeBuildStep::init()
emit addTask(Task(Task::Error,
tr("A CMake tool must be set up for building. "
"Configure a CMake tool in the kit options."),
Utils::FileName(), -1,
Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
canInit = false;
}
@@ -181,7 +181,7 @@ bool CMakeBuildStep::init()
"You asked to build the current Run Configuration's build target only, "
"but it is not associated with a build target. "
"Update the Make Step in your build settings."),
Utils::FileName(), -1,
Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
canInit = false;
}
@@ -192,7 +192,7 @@ bool CMakeBuildStep::init()
}
// Warn if doing out-of-source builds with a CMakeCache.txt is the source directory
const Utils::FileName projectDirectory = bc->target()->project()->projectDirectory();
const Utils::FilePath projectDirectory = bc->target()->project()->projectDirectory();
if (bc->buildDirectory() != projectDirectory) {
if (projectDirectory.pathAppended("CMakeCache.txt").exists()) {
emit addTask(Task(Task::Warning,
@@ -200,7 +200,7 @@ bool CMakeBuildStep::init()
"in-source build was done before. You are now building in \"%2\", "
"and the CMakeCache.txt file might confuse CMake.")
.arg(projectDirectory.toUserOutput(), bc->buildDirectory().toUserOutput()),
Utils::FileName(), -1,
Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
}
@@ -371,10 +371,10 @@ QString CMakeBuildStep::allArguments(const CMakeRunConfiguration *rc) const
return arguments;
}
Utils::FileName CMakeBuildStep::cmakeCommand() const
Utils::FilePath CMakeBuildStep::cmakeCommand() const
{
CMakeTool *tool = CMakeKitAspect::cmakeTool(target()->kit());
return tool ? tool->cmakeExecutable() : Utils::FileName();
return tool ? tool->cmakeExecutable() : Utils::FilePath();
}
QString CMakeBuildStep::cleanTarget()

View File

@@ -66,7 +66,7 @@ public:
QString allArguments(const CMakeRunConfiguration *rc) const;
Utils::FileName cmakeCommand() const;
Utils::FilePath cmakeCommand() const;
QVariantMap toMap() const override;

View File

@@ -46,17 +46,17 @@ class CMAKE_EXPORT CMakeBuildTarget
{
public:
QString title;
Utils::FileName executable; // TODO: rename to output?
Utils::FilePath executable; // TODO: rename to output?
TargetType targetType = UtilityType;
Utils::FileName workingDirectory;
Utils::FileName sourceDirectory;
Utils::FileName makeCommand;
Utils::FilePath workingDirectory;
Utils::FilePath sourceDirectory;
Utils::FilePath makeCommand;
// code model
QList<Utils::FileName> includeFiles;
QList<Utils::FilePath> includeFiles;
QStringList compilerOptions;
ProjectExplorer::Macros macros;
QList<Utils::FileName> files;
QList<Utils::FilePath> files;
};
} // namespace CMakeProjectManager

View File

@@ -46,7 +46,7 @@ namespace Internal {
////
namespace {
int distance(const FileName &targetDirectory, const FileName &fileName)
int distance(const FilePath &targetDirectory, const FilePath &fileName)
{
const QString commonParent = commonPath(QStringList({targetDirectory.toString(), fileName.toString()}));
return targetDirectory.toString().midRef(commonParent.size()).count('/')
@@ -61,12 +61,12 @@ int distance(const FileName &targetDirectory, const FileName &fileName)
void CMakeCbpParser::sortFiles()
{
QLoggingCategory log("qtc.cmakeprojectmanager.filetargetmapping", QtWarningMsg);
FileNameList fileNames = transform<QList>(m_fileList, &FileNode::filePath);
FilePathList fileNames = transform<QList>(m_fileList, &FileNode::filePath);
sort(fileNames);
CMakeBuildTarget *last = nullptr;
FileName parentDirectory;
FilePath parentDirectory;
qCDebug(log) << "###############";
qCDebug(log) << "# Pre Dump #";
@@ -96,7 +96,7 @@ void CMakeCbpParser::sortFiles()
qCDebug(log) << "# Sorting #";
qCDebug(log) << "###############";
foreach (const FileName &fileName, fileNames) {
foreach (const FilePath &fileName, fileNames) {
qCDebug(log) << fileName;
const QStringList unitTargets = m_unitTargetMap[fileName];
if (!unitTargets.isEmpty()) {
@@ -160,12 +160,12 @@ void CMakeCbpParser::sortFiles()
<< target.files << "\n";
}
bool CMakeCbpParser::parseCbpFile(CMakeTool::PathMapper mapper, const FileName &fileName,
const FileName &sourceDirectory)
bool CMakeCbpParser::parseCbpFile(CMakeTool::PathMapper mapper, const FilePath &fileName,
const FilePath &sourceDirectory)
{
m_pathMapper = mapper;
m_buildDirectory = FileName::fromString(fileName.toFileInfo().absolutePath());
m_buildDirectory = FilePath::fromString(fileName.toFileInfo().absolutePath());
m_sourceDirectory = sourceDirectory;
QFile fi(fileName.toString());
@@ -263,7 +263,7 @@ void CMakeCbpParser::parseBuildTarget()
void CMakeCbpParser::parseBuildTargetOption()
{
if (attributes().hasAttribute("output")) {
m_buildTarget.executable = m_pathMapper(FileName::fromString(attributes().value("output").toString()));
m_buildTarget.executable = m_pathMapper(FilePath::fromString(attributes().value("output").toString()));
} else if (attributes().hasAttribute("type")) {
const QStringRef value = attributes().value("type");
if (value == "0" || value == "1")
@@ -275,7 +275,7 @@ void CMakeCbpParser::parseBuildTargetOption()
else
m_buildTarget.targetType = UtilityType;
} else if (attributes().hasAttribute("working_dir")) {
m_buildTarget.workingDirectory = FileName::fromUserInput(attributes().value("working_dir").toString());
m_buildTarget.workingDirectory = FilePath::fromUserInput(attributes().value("working_dir").toString());
QFile cmakeSourceInfoFile(m_buildTarget.workingDirectory.toString()
+ QStringLiteral("/CMakeFiles/CMakeDirectoryInformation.cmake"));
@@ -287,7 +287,7 @@ void CMakeCbpParser::parseBuildTargetOption()
if (lineTopSource.startsWith(searchSource, Qt::CaseInsensitive)) {
QString src = lineTopSource.mid(searchSource.size());
src.chop(2);
m_buildTarget.sourceDirectory = FileName::fromString(src);
m_buildTarget.sourceDirectory = FilePath::fromString(src);
break;
}
}
@@ -348,7 +348,7 @@ void CMakeCbpParser::parseMakeCommands()
void CMakeCbpParser::parseBuildTargetBuild()
{
if (attributes().hasAttribute("command"))
m_buildTarget.makeCommand = m_pathMapper(FileName::fromUserInput(attributes().value("command").toString()));
m_buildTarget.makeCommand = m_pathMapper(FilePath::fromUserInput(attributes().value("command").toString()));
while (!atEnd()) {
readNext();
if (isEndElement())
@@ -387,8 +387,8 @@ void CMakeCbpParser::parseAdd()
// CMake only supports <Add option=\> and <Add directory=\>
const QXmlStreamAttributes addAttributes = attributes();
FileName includeDirectory
= m_pathMapper(FileName::fromString(addAttributes.value("directory").toString()));
FilePath includeDirectory
= m_pathMapper(FilePath::fromString(addAttributes.value("directory").toString()));
// allow adding multiple times because order happens
if (!includeDirectory.isEmpty())
@@ -416,8 +416,8 @@ void CMakeCbpParser::parseAdd()
void CMakeCbpParser::parseUnit()
{
FileName fileName =
m_pathMapper(FileName::fromUserInput(attributes().value("filename").toString()));
FilePath fileName =
m_pathMapper(FilePath::fromUserInput(attributes().value("filename").toString()));
m_parsingCMakeUnit = false;
m_unitTargets.clear();

View File

@@ -46,8 +46,8 @@ namespace Internal {
class CMakeCbpParser : public QXmlStreamReader
{
public:
bool parseCbpFile(CMakeTool::PathMapper mapper, const Utils::FileName &fileName,
const Utils::FileName &sourceDirectory);
bool parseCbpFile(CMakeTool::PathMapper mapper, const Utils::FilePath &fileName,
const Utils::FilePath &sourceDirectory);
std::vector<std::unique_ptr<ProjectExplorer::FileNode>> &&
takeFileList() { return std::move(m_fileList); }
std::vector<std::unique_ptr<ProjectExplorer::FileNode>> &&
@@ -74,19 +74,19 @@ private:
void parseUnknownElement();
void sortFiles();
QMap<Utils::FileName, QStringList> m_unitTargetMap;
QMap<Utils::FilePath, QStringList> m_unitTargetMap;
CMakeTool::PathMapper m_pathMapper;
std::vector<std::unique_ptr<ProjectExplorer::FileNode>> m_fileList;
std::vector<std::unique_ptr<ProjectExplorer::FileNode>> m_cmakeFileList;
QSet<Utils::FileName> m_processedUnits;
QSet<Utils::FilePath> m_processedUnits;
bool m_parsingCMakeUnit = false;
CMakeBuildTarget m_buildTarget;
QList<CMakeBuildTarget> m_buildTargets;
QString m_projectName;
QString m_compiler;
Utils::FileName m_sourceDirectory;
Utils::FileName m_buildDirectory;
Utils::FilePath m_sourceDirectory;
Utils::FilePath m_buildDirectory;
QStringList m_unitTargets;
};

View File

@@ -243,7 +243,7 @@ static QByteArrayList splitCMakeCacheLine(const QByteArray &line) {
<< line.mid(equalPos + 1);
}
QList<CMakeConfigItem> CMakeConfigItem::itemsFromFile(const Utils::FileName &cacheFile, QString *errorMessage)
QList<CMakeConfigItem> CMakeConfigItem::itemsFromFile(const Utils::FilePath &cacheFile, QString *errorMessage)
{
CMakeConfig result;
QFile cache(cacheFile.toString());

View File

@@ -32,7 +32,7 @@
namespace ProjectExplorer { class Kit; }
namespace Utils {
class FileName;
class FilePath;
class MacroExpander;
} // namespace Utils
@@ -57,7 +57,7 @@ public:
static std::function<bool(const CMakeConfigItem &a, const CMakeConfigItem &b)> sortOperator();
static CMakeConfigItem fromString(const QString &s);
static QList<CMakeConfigItem> itemsFromFile(const Utils::FileName &input, QString *errorMessage);
static QList<CMakeConfigItem> itemsFromFile(const Utils::FilePath &input, QString *errorMessage);
QString toString(const Utils::MacroExpander *expander = nullptr) const;
QString toArgument(const Utils::MacroExpander *expander = nullptr) const;

View File

@@ -63,7 +63,7 @@ IAssistProposal *CMakeFileCompletionAssist::perform(const AssistInterface *inter
Keywords kw;
QString fileName = interface->fileName();
if (!fileName.isEmpty() && QFileInfo(fileName).isFile()) {
Project *p = SessionManager::projectForFile(Utils::FileName::fromString(fileName));
Project *p = SessionManager::projectForFile(Utils::FilePath::fromString(fileName));
if (p && p->activeTarget()) {
CMakeTool *cmake = CMakeKitAspect::cmakeTool(p->activeTarget()->kit());
if (cmake && cmake->isValid())

View File

@@ -254,7 +254,7 @@ Tasks CMakeKitAspect::validate(const Kit *k) const
if (version.major < 3) {
result << Task(Task::Warning, tr("CMake version %1 is unsupported. Please update to "
"version 3.0 or later.").arg(QString::fromUtf8(version.fullVersion)),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
}
return result;
@@ -615,7 +615,7 @@ QVariant CMakeGeneratorKitAspect::defaultValue(const Kit *k) const
if (it != known.constEnd()) {
Utils::Environment env = Utils::Environment::systemEnvironment();
k->addToEnvironment(env);
const Utils::FileName ninjaExec = env.searchInPath(QLatin1String("ninja"));
const Utils::FilePath ninjaExec = env.searchInPath(QLatin1String("ninja"));
if (!ninjaExec.isEmpty())
return GeneratorInfo({QString("Ninja"), extraGenerator, QString(), QString()}).toVariant();
}
@@ -659,7 +659,7 @@ Tasks CMakeGeneratorKitAspect::validate(const Kit *k) const
if (tool) {
if (!tool->isValid()) {
result << Task(Task::Warning, tr("CMake Tool is unconfigured, CMake generator will be ignored."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
} else {
QList<CMakeTool::Generator> known = tool->supportedGenerators();
auto it = std::find_if(known.constBegin(), known.constEnd(), [info](const CMakeTool::Generator &g) {
@@ -667,15 +667,15 @@ Tasks CMakeGeneratorKitAspect::validate(const Kit *k) const
});
if (it == known.constEnd()) {
result << Task(Task::Warning, tr("CMake Tool does not support the configured generator."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
} else {
if (!it->supportsPlatform && !info.platform.isEmpty()) {
result << Task(Task::Warning, tr("Platform is not supported by the selected CMake generator."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
if (!it->supportsToolset && !info.toolset.isEmpty()) {
result << Task(Task::Warning, tr("Toolset is not supported by the selected CMake generator."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
}
if (!tool->hasServerMode() && info.extraGenerator != "CodeBlocks") {
@@ -683,7 +683,7 @@ Tasks CMakeGeneratorKitAspect::validate(const Kit *k) const
"generator does not generate a CodeBlocks file. "
"%1 will not be able to parse CMake projects.")
.arg(Core::Constants::IDE_DISPLAY_NAME),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
}
}
@@ -962,14 +962,14 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
const CMakeConfig config = configuration(k);
const bool isQt4 = version && version->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0);
Utils::FileName qmakePath;
Utils::FilePath qmakePath;
QStringList qtInstallDirs;
Utils::FileName tcCPath;
Utils::FileName tcCxxPath;
Utils::FilePath tcCPath;
Utils::FilePath tcCxxPath;
foreach (const CMakeConfigItem &i, config) {
// Do not use expand(QByteArray) as we cannot be sure the input is latin1
const Utils::FileName expandedValue
= Utils::FileName::fromString(k->macroExpander()->expand(QString::fromUtf8(i.value)));
const Utils::FilePath expandedValue
= Utils::FilePath::fromString(k->macroExpander()->expand(QString::fromUtf8(i.value)));
if (i.key == CMAKE_QMAKE_KEY)
qmakePath = expandedValue;
else if (i.key == CMAKE_C_TOOLCHAIN_KEY)
@@ -986,25 +986,25 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
if (version && version->isValid() && isQt4) {
result << Task(Task::Warning, tr("CMake configuration has no path to qmake binary set, "
"even though the kit has a valid Qt version."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
} else {
if (!version || !version->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has a path to a qmake binary set, "
"even though the kit has no valid Qt version."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
} else if (qmakePath != version->qmakeCommand() && isQt4) {
result << Task(Task::Warning, tr("CMake configuration has a path to a qmake binary set "
"that does not match the qmake binary path "
"configured in the Qt version."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
}
if (version && !qtInstallDirs.contains(version->qmakeProperty("QT_INSTALL_PREFIX")) && !isQt4) {
if (version->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has no CMAKE_PREFIX_PATH set "
"that points to the kit Qt version."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
}
@@ -1013,18 +1013,18 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
if (tcC && tcC->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has no path to a C compiler set, "
"even though the kit has a valid tool chain."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
} else {
if (!tcC || !tcC->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has a path to a C compiler set, "
"even though the kit has no valid tool chain."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
} else if (tcCPath != tcC->compilerCommand()) {
result << Task(Task::Warning, tr("CMake configuration has a path to a C compiler set "
"that does not match the compiler path "
"configured in the tool chain of the kit."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
}
@@ -1032,18 +1032,18 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
if (tcCxx && tcCxx->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has no path to a C++ compiler set, "
"even though the kit has a valid tool chain."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
} else {
if (!tcCxx || !tcCxx->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has a path to a C++ compiler set, "
"even though the kit has no valid tool chain."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
} else if (tcCxxPath != tcCxx->compilerCommand()) {
result << Task(Task::Warning, tr("CMake configuration has a path to a C++ compiler set "
"that does not match the compiler path "
"configured in the tool chain of the kit."),
Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
}

View File

@@ -67,12 +67,12 @@ void CMakeParser::stdError(const QString &line)
m_skippedFirstEmptyLine = false;
if (m_commonError.indexIn(trimmedLine) != -1) {
m_lastTask = Task(Task::Error, QString(), Utils::FileName::fromUserInput(m_commonError.cap(1)),
m_lastTask = Task(Task::Error, QString(), Utils::FilePath::fromUserInput(m_commonError.cap(1)),
m_commonError.cap(2).toInt(), Constants::TASK_CATEGORY_BUILDSYSTEM);
m_lines = 1;
return;
} else if (m_nextSubError.indexIn(trimmedLine) != -1) {
m_lastTask = Task(Task::Error, QString(), Utils::FileName::fromUserInput(m_nextSubError.cap(1)), -1,
m_lastTask = Task(Task::Error, QString(), Utils::FilePath::fromUserInput(m_nextSubError.cap(1)), -1,
Constants::TASK_CATEGORY_BUILDSYSTEM);
m_lines = 1;
return;
@@ -86,11 +86,11 @@ void CMakeParser::stdError(const QString &line)
m_expectTripleLineErrorData = LINE_LOCATION;
doFlush();
m_lastTask = Task(trimmedLine.contains(QLatin1String("Error")) ? Task::Error : Task::Warning,
QString(), Utils::FileName(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM);
QString(), Utils::FilePath(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM);
return;
} else if (trimmedLine.startsWith("CMake Error: ")) {
m_lastTask = Task(Task::Error, trimmedLine.mid(13),
Utils::FileName(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM);
Utils::FilePath(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM);
m_lines = 1;
return;
}
@@ -100,7 +100,7 @@ void CMakeParser::stdError(const QString &line)
{
QRegularExpressionMatch m = m_locationLine.match(trimmedLine);
QTC_CHECK(m.hasMatch());
m_lastTask.file = Utils::FileName::fromUserInput(trimmedLine.mid(0, m.capturedStart()));
m_lastTask.file = Utils::FilePath::fromUserInput(trimmedLine.mid(0, m.capturedStart()));
m_lastTask.line = m.captured(1).toInt();
m_expectTripleLineErrorData = LINE_DESCRIPTION;
}
@@ -180,11 +180,11 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("Cannot find source file: unknownFile.qml Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx"),
Utils::FileName::fromUserInput(QLatin1String("src/1/app/CMakeLists.txt")), 70,
Utils::FilePath::fromUserInput(QLatin1String("src/1/app/CMakeLists.txt")), 70,
categoryBuild)
<< Task(Task::Error,
QLatin1String("Cannot find source file: CMakeLists.txt2 Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx"),
Utils::FileName::fromUserInput(QLatin1String("src/1/app/CMakeLists.txt")), -1,
Utils::FilePath::fromUserInput(QLatin1String("src/1/app/CMakeLists.txt")), -1,
categoryBuild))
<< QString();
@@ -196,7 +196,7 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("add_subdirectory given source \"app1\" which is not an existing directory."),
Utils::FileName::fromUserInput(QLatin1String("src/1/CMakeLists.txt")), 8,
Utils::FilePath::fromUserInput(QLatin1String("src/1/CMakeLists.txt")), 8,
categoryBuild))
<< QString();
@@ -208,7 +208,7 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("Unknown CMake command \"i_am_wrong_command\"."),
Utils::FileName::fromUserInput(QLatin1String("src/1/CMakeLists.txt")), 8,
Utils::FilePath::fromUserInput(QLatin1String("src/1/CMakeLists.txt")), 8,
categoryBuild))
<< QString();
@@ -220,7 +220,7 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("message called with incorrect number of arguments"),
Utils::FileName::fromUserInput(QLatin1String("src/1/CMakeLists.txt")), 8,
Utils::FilePath::fromUserInput(QLatin1String("src/1/CMakeLists.txt")), 8,
categoryBuild))
<< QString();
@@ -234,7 +234,7 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("Parse error. Expected \"(\", got newline with text \"\n\"."),
Utils::FileName::fromUserInput(QLatin1String("/test/path/CMakeLists.txt")), 9,
Utils::FilePath::fromUserInput(QLatin1String("/test/path/CMakeLists.txt")), 9,
categoryBuild))
<< QString();
@@ -247,7 +247,7 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("Error required internal CMake variable not set, cmake may be not be built correctly."),
Utils::FileName(), -1, categoryBuild))
Utils::FilePath(), -1, categoryBuild))
<< QString();
QTest::newRow("cmake error at")
@@ -260,7 +260,7 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("Parse error. Expected \"(\", got newline with text \" \"."),
Utils::FileName::fromUserInput(QLatin1String("CMakeLists.txt")), 4,
Utils::FilePath::fromUserInput(QLatin1String("CMakeLists.txt")), 4,
categoryBuild))
<< QString();
@@ -273,7 +273,7 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< (Tasks()
<< Task(Task::Warning,
QLatin1String("Argument not separated from preceding token by whitespace."),
Utils::FileName::fromUserInput(QLatin1String("/test/path/CMakeLists.txt")), 9,
Utils::FilePath::fromUserInput(QLatin1String("/test/path/CMakeLists.txt")), 9,
categoryBuild))
<< QString();
}

View File

@@ -80,7 +80,7 @@ static CMakeBuildConfiguration *activeBc(const CMakeProject *p)
/*!
\class CMakeProject
*/
CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEMIMETYPE, fileName),
CMakeProject::CMakeProject(const FilePath &fileName) : Project(Constants::CMAKEMIMETYPE, fileName),
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater)
{
setId(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
@@ -213,7 +213,7 @@ CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEM
// TreeScanner:
connect(&m_treeScanner, &TreeScanner::finished, this, &CMakeProject::handleTreeScanningFinished);
m_treeScanner.setFilter([this](const Utils::MimeType &mimeType, const Utils::FileName &fn) {
m_treeScanner.setFilter([this](const Utils::MimeType &mimeType, const Utils::FilePath &fn) {
// Mime checks requires more resources, so keep it last in check list
auto isIgnored =
fn.toString().startsWith(projectFilePath().toString() + ".user") ||
@@ -233,7 +233,7 @@ CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEM
return isIgnored;
});
m_treeScanner.setTypeFactory([](const Utils::MimeType &mimeType, const Utils::FileName &fn) {
m_treeScanner.setTypeFactory([](const Utils::MimeType &mimeType, const Utils::FilePath &fn) {
auto type = TreeScanner::genericFileType(mimeType, fn);
if (type == FileType::Unknown) {
if (mimeType.isValid()) {
@@ -381,7 +381,7 @@ void CMakeProject::updateQmlJSCodeModel()
}
foreach (const QString &cmakeImport, CMakeConfigItem::cmakeSplitValue(cmakeImports))
projectInfo.importPaths.maybeInsert(FileName::fromString(cmakeImport), QmlJS::Dialect::Qml);
projectInfo.importPaths.maybeInsert(FilePath::fromString(cmakeImport), QmlJS::Dialect::Qml);
modelManager->updateProjectInfo(projectInfo, this);
}
@@ -588,16 +588,16 @@ QStringList CMakeProject::filesGeneratedFrom(const QString &sourceFile) const
if (!activeTarget())
return QStringList();
QFileInfo fi(sourceFile);
FileName project = projectDirectory();
FileName baseDirectory = FileName::fromString(fi.absolutePath());
FilePath project = projectDirectory();
FilePath baseDirectory = FilePath::fromString(fi.absolutePath());
while (baseDirectory.isChildOf(project)) {
const FileName cmakeListsTxt = baseDirectory.pathAppended("CMakeLists.txt");
const FilePath cmakeListsTxt = baseDirectory.pathAppended("CMakeLists.txt");
if (cmakeListsTxt.exists())
break;
QDir dir(baseDirectory.toString());
dir.cdUp();
baseDirectory = FileName::fromString(dir.absolutePath());
baseDirectory = FilePath::fromString(dir.absolutePath());
}
QDir srcDirRoot = QDir(project.toString());
@@ -623,7 +623,7 @@ QStringList CMakeProject::filesGeneratedFrom(const QString &sourceFile) const
ProjectExplorer::DeploymentKnowledge CMakeProject::deploymentKnowledge() const
{
return contains(files(AllFiles), [](const FileName &f) {
return contains(files(AllFiles), [](const FilePath &f) {
return f.fileName() == "QtCreatorDeployment.txt";
}) ? DeploymentKnowledge::Approximative : DeploymentKnowledge::Bad;
}
@@ -658,7 +658,7 @@ QList<ProjectExplorer::ExtraCompiler *> CMakeProject::findExtraCompilers() const
= Utils::transform<QSet>(factories, &ExtraCompilerFactory::sourceTag);
// Find all files generated by any of the extra compilers, in a rather crude way.
const FileNameList fileList = files([&fileExtensions](const Node *n) {
const FilePathList fileList = files([&fileExtensions](const Node *n) {
if (!SourceFiles(n))
return false;
const QString fp = n->filePath().toString();
@@ -667,7 +667,7 @@ QList<ProjectExplorer::ExtraCompiler *> CMakeProject::findExtraCompilers() const
});
// Generate the necessary information:
for (const FileName &file : fileList) {
for (const FilePath &file : fileList) {
ExtraCompilerFactory *factory = Utils::findOrDefault(factories, [&file](const ExtraCompilerFactory *f) {
return file.endsWith('.' + f->sourceTag());
});
@@ -677,9 +677,9 @@ QList<ProjectExplorer::ExtraCompiler *> CMakeProject::findExtraCompilers() const
if (generated.isEmpty())
continue;
const FileNameList fileNames
const FilePathList fileNames
= transform(generated,
[](const QString &s) { return FileName::fromString(s); });
[](const QString &s) { return FilePath::fromString(s); });
extraCompilers.append(factory->create(this, file, fileNames));
}

View File

@@ -60,7 +60,7 @@ class CMAKE_EXPORT CMakeProject : public ProjectExplorer::Project
Q_OBJECT
public:
explicit CMakeProject(const Utils::FileName &filename);
explicit CMakeProject(const Utils::FilePath &filename);
~CMakeProject() final;
QStringList buildTargetTitles() const;

View File

@@ -56,7 +56,7 @@ Q_LOGGING_CATEGORY(cmInputLog, "qtc.cmake.import", QtWarningMsg);
struct CMakeToolChainData
{
QByteArray languageId;
Utils::FileName compilerPath;
Utils::FilePath compilerPath;
Core::Id mapLanguageIdToQtC() const
{
const QByteArray li = languageId.toLower();
@@ -73,10 +73,10 @@ struct DirectoryData
{
// Project Stuff:
QByteArray cmakeBuildType;
Utils::FileName buildDirectory;
Utils::FilePath buildDirectory;
// Kit Stuff
Utils::FileName cmakeBinary;
Utils::FilePath cmakeBinary;
QByteArray generator;
QByteArray extraGenerator;
QByteArray platform;
@@ -106,7 +106,7 @@ static QStringList scanDirectory(const QString &path, const QString &prefix)
namespace CMakeProjectManager {
namespace Internal {
CMakeProjectImporter::CMakeProjectImporter(const Utils::FileName &path) : QtProjectImporter(path)
CMakeProjectImporter::CMakeProjectImporter(const Utils::FilePath &path) : QtProjectImporter(path)
{
useTemporaryKitAspect(CMakeKitAspect::id(),
[this](Kit *k, const QVariantList &vl) { cleanupTemporaryCMake(k, vl); },
@@ -131,24 +131,24 @@ QStringList CMakeProjectImporter::importCandidates()
return finalists;
}
static Utils::FileName qmakeFromCMakeCache(const CMakeConfig &config)
static Utils::FilePath qmakeFromCMakeCache(const CMakeConfig &config)
{
// Qt4 way to define things (more convenient for us, so try this first;-)
Utils::FileName qmake
= Utils::FileName::fromUtf8(CMakeConfigItem::valueOf(QByteArray("QT_QMAKE_EXECUTABLE"), config));
Utils::FilePath qmake
= Utils::FilePath::fromUtf8(CMakeConfigItem::valueOf(QByteArray("QT_QMAKE_EXECUTABLE"), config));
qCDebug(cmInputLog()) << "QT_QMAKE_EXECUTABLE=" << qmake.toUserOutput();
if (!qmake.isEmpty())
return qmake;
// Check Qt5 settings: oh, the horror!
const Utils::FileName qtCMakeDir
= Utils::FileName::fromUtf8(CMakeConfigItem::valueOf(QByteArray("Qt5Core_DIR"), config));
const Utils::FilePath qtCMakeDir
= Utils::FilePath::fromUtf8(CMakeConfigItem::valueOf(QByteArray("Qt5Core_DIR"), config));
qCDebug(cmInputLog()) << "Qt5Core_DIR=" << qtCMakeDir.toUserOutput();
const Utils::FileName canQtCMakeDir = Utils::FileName::fromString(qtCMakeDir.toFileInfo().canonicalFilePath());
const Utils::FilePath canQtCMakeDir = Utils::FilePath::fromString(qtCMakeDir.toFileInfo().canonicalFilePath());
qCInfo(cmInputLog()) << "Qt5Core_DIR (canonical)=" << canQtCMakeDir.toUserOutput();
if (qtCMakeDir.isEmpty())
return Utils::FileName();
const Utils::FileName baseQtDir = canQtCMakeDir.parentDir().parentDir().parentDir(); // Up 3 levels...
return Utils::FilePath();
const Utils::FilePath baseQtDir = canQtCMakeDir.parentDir().parentDir().parentDir(); // Up 3 levels...
qCDebug(cmInputLog()) << "BaseQtDir:" << baseQtDir.toUserOutput();
// "Parse" Qt5Core/Qt5CoreConfigExtras.cmake:
@@ -167,7 +167,7 @@ static Utils::FileName qmakeFromCMakeCache(const CMakeConfig &config)
QFile extras(qtCMakeDir.toString() + "/Qt5CoreConfigExtras.cmake");
if (!extras.open(QIODevice::ReadOnly))
return Utils::FileName();
return Utils::FilePath();
QByteArray data;
bool inQmakeSection = false;
@@ -202,9 +202,9 @@ static Utils::FileName qmakeFromCMakeCache(const CMakeConfig &config)
const int sp = origLine.indexOf('}');
const int ep = origLine.lastIndexOf('"');
QTC_ASSERT(sp > 0, return Utils::FileName());
QTC_ASSERT(ep > sp + 2, return Utils::FileName());
QTC_ASSERT(ep < origLine.count(), return Utils::FileName());
QTC_ASSERT(sp > 0, return Utils::FilePath());
QTC_ASSERT(ep > sp + 2, return Utils::FilePath());
QTC_ASSERT(ep < origLine.count(), return Utils::FilePath());
// Eat the leading "}/" and trailing "
const QByteArray locationPart = origLine.mid(sp + 2, ep - 2 - sp);
@@ -215,7 +215,7 @@ static Utils::FileName qmakeFromCMakeCache(const CMakeConfig &config)
}
// Now try to make sense of .../Qt5CoreConfig.cmake:
return Utils::FileName();
return Utils::FilePath();
}
QVector<CMakeToolChainData> extractToolChainsFromCache(const CMakeConfig &config)
@@ -225,15 +225,15 @@ QVector<CMakeToolChainData> extractToolChainsFromCache(const CMakeConfig &config
if (!i.key.startsWith("CMAKE_") || !i.key.endsWith("_COMPILER"))
continue;
const QByteArray language = i.key.mid(6, i.key.count() - 6 - 9); // skip "CMAKE_" and "_COMPILER"
result.append({language, Utils::FileName::fromUtf8(i.value)});
result.append({language, Utils::FilePath::fromUtf8(i.value)});
}
return result;
}
QList<void *> CMakeProjectImporter::examineDirectory(const Utils::FileName &importPath) const
QList<void *> CMakeProjectImporter::examineDirectory(const Utils::FilePath &importPath) const
{
qCInfo(cmInputLog()) << "Examining directory:" << importPath.toUserOutput();
const FileName cacheFile = importPath.pathAppended("CMakeCache.txt");
const FilePath cacheFile = importPath.pathAppended("CMakeCache.txt");
if (!cacheFile.exists()) {
qCDebug(cmInputLog()) << cacheFile.toUserOutput() << "does not exist, returning.";
@@ -247,8 +247,8 @@ QList<void *> CMakeProjectImporter::examineDirectory(const Utils::FileName &impo
return { };
}
const auto homeDir
= Utils::FileName::fromUserInput(QString::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", config)));
const Utils::FileName canonicalProjectDirectory = projectDirectory().canonicalPath();
= Utils::FilePath::fromUserInput(QString::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", config)));
const Utils::FilePath canonicalProjectDirectory = projectDirectory().canonicalPath();
if (homeDir != canonicalProjectDirectory) {
qCDebug(cmInputLog()) << "Wrong source directory:" << homeDir.toUserOutput()
<< "expected:" << canonicalProjectDirectory.toUserOutput();
@@ -260,7 +260,7 @@ QList<void *> CMakeProjectImporter::examineDirectory(const Utils::FileName &impo
data->cmakeBuildType = CMakeConfigItem::valueOf("CMAKE_BUILD_TYPE", config);
data->cmakeBinary
= Utils::FileName::fromUtf8(CMakeConfigItem::valueOf("CMAKE_COMMAND", config));
= Utils::FilePath::fromUtf8(CMakeConfigItem::valueOf("CMAKE_COMMAND", config));
data->generator = CMakeConfigItem::valueOf("CMAKE_GENERATOR", config);
data->extraGenerator = CMakeConfigItem::valueOf("CMAKE_EXTRA_GENERATOR", config);
data->platform = CMakeConfigItem::valueOf("CMAKE_GENERATOR_PLATFORM", config);
@@ -269,7 +269,7 @@ QList<void *> CMakeProjectImporter::examineDirectory(const Utils::FileName &impo
data->sysroot = CMakeConfigItem::valueOf("CMAKE_SYSROOT", config);
// Qt:
const Utils::FileName qmake = qmakeFromCMakeCache(config);
const Utils::FilePath qmake = qmakeFromCMakeCache(config);
if (!qmake.isEmpty())
data->qt = findOrCreateQtVersion(qmake);
@@ -294,7 +294,7 @@ bool CMakeProjectImporter::matchKit(void *directoryData, const Kit *k) const
|| CMakeGeneratorKitAspect::toolset(k) != QString::fromUtf8(data->toolset))
return false;
if (SysRootKitAspect::sysRoot(k) != Utils::FileName::fromUtf8(data->sysroot))
if (SysRootKitAspect::sysRoot(k) != Utils::FilePath::fromUtf8(data->sysroot))
return false;
if (data->qt.qt && QtSupport::QtKitAspect::qtVersionId(k) != data->qt.qt->uniqueId())
@@ -326,7 +326,7 @@ Kit *CMakeProjectImporter::createKit(void *directoryData) const
CMakeGeneratorKitAspect::setPlatform(k, QString::fromUtf8(data->platform));
CMakeGeneratorKitAspect::setToolset(k, QString::fromUtf8(data->toolset));
SysRootKitAspect::setSysRoot(k, Utils::FileName::fromUtf8(data->sysroot));
SysRootKitAspect::setSysRoot(k, Utils::FilePath::fromUtf8(data->sysroot));
for (const CMakeToolChainData &cmtcd : data->toolChains) {
const ToolChainData tcd
@@ -364,7 +364,7 @@ const QList<BuildInfo> CMakeProjectImporter::buildInfoListForKit(const Kit *k, v
}
CMakeProjectImporter::CMakeToolData
CMakeProjectImporter::findOrCreateCMakeTool(const Utils::FileName &cmakeToolPath) const
CMakeProjectImporter::findOrCreateCMakeTool(const Utils::FilePath &cmakeToolPath) const
{
CMakeToolData result;
result.cmakeTool = CMakeToolManager::findByCommand(cmakeToolPath);
@@ -448,7 +448,7 @@ void CMakeProjectPlugin::testCMakeProjectImporterQt()
config.append(CMakeConfigItem(key.toUtf8(), value.toUtf8()));
}
Utils::FileName realQmake = qmakeFromCMakeCache(config);
Utils::FilePath realQmake = qmakeFromCMakeCache(config);
QCOMPARE(realQmake.toString(), expectedQmake);
}
void CMakeProjectPlugin::testCMakeProjectImporterToolChain_data()

View File

@@ -36,12 +36,12 @@ namespace Internal {
class CMakeProjectImporter : public QtSupport::QtProjectImporter
{
public:
CMakeProjectImporter(const Utils::FileName &path);
CMakeProjectImporter(const Utils::FilePath &path);
QStringList importCandidates() final;
private:
QList<void *> examineDirectory(const Utils::FileName &importPath) const final;
QList<void *> examineDirectory(const Utils::FilePath &importPath) const final;
bool matchKit(void *directoryData, const ProjectExplorer::Kit *k) const final;
ProjectExplorer::Kit *createKit(void *directoryData) const final;
const QList<ProjectExplorer::BuildInfo> buildInfoListForKit(const ProjectExplorer::Kit *k,
@@ -51,7 +51,7 @@ private:
bool isTemporary = false;
CMakeTool *cmakeTool = nullptr;
};
CMakeToolData findOrCreateCMakeTool(const Utils::FileName &cmakeToolPath) const;
CMakeToolData findOrCreateCMakeTool(const Utils::FilePath &cmakeToolPath) const;
void deleteDirectoryData(void *directoryData) const final;

View File

@@ -115,7 +115,7 @@ void noAutoAdditionNotify(const QStringList &filePaths, const ProjectExplorer::P
}
CMakeInputsNode::CMakeInputsNode(const Utils::FileName &cmakeLists) :
CMakeInputsNode::CMakeInputsNode(const Utils::FilePath &cmakeLists) :
ProjectExplorer::ProjectNode(cmakeLists)
{
setPriority(Node::DefaultPriority - 10); // Bottom most!
@@ -124,7 +124,7 @@ CMakeInputsNode::CMakeInputsNode(const Utils::FileName &cmakeLists) :
setListInProject(false);
}
CMakeListsNode::CMakeListsNode(const Utils::FileName &cmakeListPath) :
CMakeListsNode::CMakeListsNode(const Utils::FilePath &cmakeListPath) :
ProjectExplorer::ProjectNode(cmakeListPath)
{
static QIcon folderIcon = Core::FileIconProvider::directoryIcon(Constants::FILEOVERLAY_CMAKE);
@@ -142,12 +142,12 @@ bool CMakeListsNode::supportsAction(ProjectExplorer::ProjectAction action, const
return action == ProjectExplorer::ProjectAction::AddNewFile;
}
Utils::optional<Utils::FileName> CMakeListsNode::visibleAfterAddFileAction() const
Utils::optional<Utils::FilePath> CMakeListsNode::visibleAfterAddFileAction() const
{
return filePath().pathAppended("CMakeLists.txt");
}
CMakeProjectNode::CMakeProjectNode(const Utils::FileName &directory) :
CMakeProjectNode::CMakeProjectNode(const Utils::FilePath &directory) :
ProjectExplorer::ProjectNode(directory)
{
setPriority(Node::DefaultProjectPriority + 1000);
@@ -166,7 +166,7 @@ bool CMakeProjectNode::addFiles(const QStringList &filePaths, QStringList *)
return true; // Return always true as autoadd is not supported!
}
CMakeTargetNode::CMakeTargetNode(const Utils::FileName &directory, const QString &target) :
CMakeTargetNode::CMakeTargetNode(const Utils::FilePath &directory, const QString &target) :
ProjectExplorer::ProjectNode(directory)
{
m_target = target;
@@ -176,7 +176,7 @@ CMakeTargetNode::CMakeTargetNode(const Utils::FileName &directory, const QString
setIsProduct();
}
QString CMakeTargetNode::generateId(const Utils::FileName &directory, const QString &target)
QString CMakeTargetNode::generateId(const Utils::FilePath &directory, const QString &target)
{
return directory.toString() + "///::///" + target;
}
@@ -249,19 +249,19 @@ bool CMakeTargetNode::addFiles(const QStringList &filePaths, QStringList *)
return true; // Return always true as autoadd is not supported!
}
Utils::optional<Utils::FileName> CMakeTargetNode::visibleAfterAddFileAction() const
Utils::optional<Utils::FilePath> CMakeTargetNode::visibleAfterAddFileAction() const
{
return filePath().pathAppended("CMakeLists.txt");
}
void CMakeTargetNode::setTargetInformation(const QList<Utils::FileName> &artifacts,
void CMakeTargetNode::setTargetInformation(const QList<Utils::FilePath> &artifacts,
const QString &type)
{
m_tooltip = QCoreApplication::translate("CMakeTargetNode", "Target type: ") + type + "<br>";
if (artifacts.isEmpty()) {
m_tooltip += QCoreApplication::translate("CMakeTargetNode", "No build artifacts");
} else {
const QStringList tmp = Utils::transform(artifacts, &Utils::FileName::toUserOutput);
const QStringList tmp = Utils::transform(artifacts, &Utils::FilePath::toUserOutput);
m_tooltip += QCoreApplication::translate("CMakeTargetNode", "Build artifacts:") + "<br>"
+ tmp.join("<br>");
}

View File

@@ -35,23 +35,23 @@ namespace Internal {
class CMakeInputsNode : public ProjectExplorer::ProjectNode
{
public:
CMakeInputsNode(const Utils::FileName &cmakeLists);
CMakeInputsNode(const Utils::FilePath &cmakeLists);
};
class CMakeListsNode : public ProjectExplorer::ProjectNode
{
public:
CMakeListsNode(const Utils::FileName &cmakeListPath);
CMakeListsNode(const Utils::FilePath &cmakeListPath);
bool showInSimpleTree() const final;
bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const override;
Utils::optional<Utils::FileName> visibleAfterAddFileAction() const override;
Utils::optional<Utils::FilePath> visibleAfterAddFileAction() const override;
};
class CMakeProjectNode : public ProjectExplorer::ProjectNode
{
public:
CMakeProjectNode(const Utils::FileName &directory);
CMakeProjectNode(const Utils::FilePath &directory);
QString tooltip() const final;
@@ -61,18 +61,18 @@ public:
class CMakeTargetNode : public ProjectExplorer::ProjectNode
{
public:
CMakeTargetNode(const Utils::FileName &directory, const QString &target);
CMakeTargetNode(const Utils::FilePath &directory, const QString &target);
static QString generateId(const Utils::FileName &directory, const QString &target);
static QString generateId(const Utils::FilePath &directory, const QString &target);
void setTargetInformation(const QList<Utils::FileName> &artifacts, const QString &type);
void setTargetInformation(const QList<Utils::FilePath> &artifacts, const QString &type);
QString tooltip() const final;
QString buildKey() const final;
bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const override;
bool addFiles(const QStringList &filePaths, QStringList *notAdded) override;
Utils::optional<Utils::FileName> visibleAfterAddFileAction() const override;
Utils::optional<Utils::FilePath> visibleAfterAddFileAction() const override;
QVariant data(Core::Id role) const override;
void setConfig(const CMakeConfig &config);

View File

@@ -67,12 +67,12 @@ public:
CMakeToolTreeItem *cmakeToolItem(const Core::Id &id) const;
CMakeToolTreeItem *cmakeToolItem(const QModelIndex &index) const;
QModelIndex addCMakeTool(const QString &name, const FileName &executable, const bool autoRun, const bool autoCreate, const bool isAutoDetected);
QModelIndex addCMakeTool(const QString &name, const FilePath &executable, const bool autoRun, const bool autoCreate, const bool isAutoDetected);
void addCMakeTool(const CMakeTool *item, bool changed);
TreeItem *autoGroupItem() const;
TreeItem *manualGroupItem() const;
void reevaluateChangedFlag(CMakeToolTreeItem *item) const;
void updateCMakeTool(const Core::Id &id, const QString &displayName, const FileName &executable,
void updateCMakeTool(const Core::Id &id, const QString &displayName, const FilePath &executable,
bool autoRun, bool autoCreate);
void removeCMakeTool(const Core::Id &id);
void apply();
@@ -101,7 +101,7 @@ public:
m_changed(changed)
{}
CMakeToolTreeItem(const QString &name, const Utils::FileName &executable,
CMakeToolTreeItem(const QString &name, const Utils::FilePath &executable,
bool autoRun, bool autoCreate, bool autodetected) :
m_id(Core::Id::fromString(QUuid::createUuid().toString())),
m_name(name),
@@ -143,7 +143,7 @@ public:
Core::Id m_id;
QString m_name;
FileName m_executable;
FilePath m_executable;
bool m_isAutoRun = true;
bool m_autoCreateBuildDirectory = false;
bool m_autodetected = false;
@@ -168,7 +168,7 @@ CMakeToolItemModel::CMakeToolItemModel()
}
QModelIndex CMakeToolItemModel::addCMakeTool(const QString &name, const FileName &executable,
QModelIndex CMakeToolItemModel::addCMakeTool(const QString &name, const FilePath &executable,
const bool autoRun, const bool autoCreate,
const bool isAutoDetected)
{
@@ -223,7 +223,7 @@ void CMakeToolItemModel::reevaluateChangedFlag(CMakeToolTreeItem *item) const
}
void CMakeToolItemModel::updateCMakeTool(const Core::Id &id, const QString &displayName,
const FileName &executable, bool autoRun,
const FilePath &executable, bool autoRun,
bool autoCreate)
{
CMakeToolTreeItem *treeItem = cmakeToolItem(id);
@@ -519,7 +519,7 @@ void CMakeToolConfigWidget::cloneCMakeTool()
void CMakeToolConfigWidget::addCMakeTool()
{
QModelIndex newItem = m_model.addCMakeTool(m_model.uniqueDisplayName(tr("New CMake")),
FileName(), true, false, false);
FilePath(), true, false, false);
m_cmakeToolsView->setCurrentIndex(newItem);
}

View File

@@ -102,7 +102,7 @@ CMakeTool::CMakeTool(const QVariantMap &map, bool fromSdk) :
if (!fromSdk)
m_isAutoDetected = map.value(CMAKE_INFORMATION_AUTODETECTED, false).toBool();
setCMakeExecutable(Utils::FileName::fromString(map.value(CMAKE_INFORMATION_COMMAND).toString()));
setCMakeExecutable(Utils::FilePath::fromString(map.value(CMAKE_INFORMATION_COMMAND).toString()));
}
CMakeTool::~CMakeTool() = default;
@@ -112,7 +112,7 @@ Core::Id CMakeTool::createId()
return Core::Id::fromString(QUuid::createUuid().toString());
}
void CMakeTool::setCMakeExecutable(const Utils::FileName &executable)
void CMakeTool::setCMakeExecutable(const Utils::FilePath &executable)
{
if (m_executable == executable)
return;
@@ -187,10 +187,10 @@ QVariantMap CMakeTool::toMap() const
return data;
}
Utils::FileName CMakeTool::cmakeExecutable() const
Utils::FilePath CMakeTool::cmakeExecutable() const
{
if (Utils::HostOsInfo::isMacHost() && m_executable.endsWith(".app")) {
const Utils::FileName toTest = m_executable.pathAppended("Contents/bin/cmake");
const Utils::FilePath toTest = m_executable.pathAppended("Contents/bin/cmake");
if (toTest.exists())
return toTest;
}
@@ -279,7 +279,7 @@ CMakeTool::PathMapper CMakeTool::pathMapper() const
{
if (m_pathMapper)
return m_pathMapper;
return [](const Utils::FileName &fn) { return fn; };
return [](const Utils::FilePath &fn) { return fn; };
}
void CMakeTool::readInformation(CMakeTool::QueryType type) const

View File

@@ -76,7 +76,7 @@ public:
bool matches(const QString &n, const QString &ex) const;
};
using PathMapper = std::function<Utils::FileName (const Utils::FileName &)>;
using PathMapper = std::function<Utils::FilePath (const Utils::FilePath &)>;
explicit CMakeTool(Detection d, const Core::Id &id);
explicit CMakeTool(const QVariantMap &map, bool fromSdk);
@@ -89,11 +89,11 @@ public:
Core::Id id() const { return m_id; }
QVariantMap toMap () const;
void setCMakeExecutable(const Utils::FileName &executable);
void setCMakeExecutable(const Utils::FilePath &executable);
void setAutorun(bool autoRun);
void setAutoCreateBuildDirectory(bool autoBuildDir);
Utils::FileName cmakeExecutable() const;
Utils::FilePath cmakeExecutable() const;
bool isAutoRun() const;
bool autoCreateBuildDirectory() const;
QList<Generator> supportedGenerators() const;
@@ -129,7 +129,7 @@ private:
Core::Id m_id;
QString m_displayName;
Utils::FileName m_executable;
Utils::FilePath m_executable;
bool m_isAutoRun = true;
bool m_isAutoDetected = false;

View File

@@ -86,7 +86,7 @@ QList<CMakeTool *> CMakeToolManager::cmakeTools()
return Utils::toRawPointer<QList>(d->m_cmakeTools);
}
Id CMakeToolManager::registerOrFindCMakeTool(const FileName &command)
Id CMakeToolManager::registerOrFindCMakeTool(const FilePath &command)
{
if (CMakeTool *cmake = findByCommand(command))
return cmake->id();
@@ -149,7 +149,7 @@ void CMakeToolManager::setDefaultCMakeTool(const Id &id)
ensureDefaultCMakeToolIsValid();
}
CMakeTool *CMakeToolManager::findByCommand(const FileName &command)
CMakeTool *CMakeToolManager::findByCommand(const FilePath &command)
{
return Utils::findOrDefault(d->m_cmakeTools, Utils::equal(&CMakeTool::cmakeExecutable, command));
}

View File

@@ -47,13 +47,13 @@ public:
static QList<CMakeTool *> cmakeTools();
static Core::Id registerOrFindCMakeTool(const Utils::FileName &command);
static Core::Id registerOrFindCMakeTool(const Utils::FilePath &command);
static bool registerCMakeTool(std::unique_ptr<CMakeTool> &&tool);
static void deregisterCMakeTool(const Core::Id &id);
static CMakeTool *defaultCMakeTool();
static void setDefaultCMakeTool(const Core::Id &id);
static CMakeTool *findByCommand(const Utils::FileName &command);
static CMakeTool *findByCommand(const Utils::FilePath &command);
static CMakeTool *findById(const Core::Id &id);
static void notifyAboutUpdate(CMakeTool *);

View File

@@ -72,30 +72,30 @@ static std::vector<std::unique_ptr<CMakeTool>> autoDetectCMakeTools()
{
Utils::Environment env = Environment::systemEnvironment();
Utils::FileNameList path = env.path();
Utils::FilePathList path = env.path();
path = Utils::filteredUnique(path);
if (HostOsInfo::isWindowsHost()) {
const QString progFiles = QLatin1String(qgetenv("ProgramFiles"));
path.append(Utils::FileName::fromString(progFiles + "/CMake"));
path.append(Utils::FileName::fromString(progFiles + "/CMake/bin"));
path.append(Utils::FilePath::fromString(progFiles + "/CMake"));
path.append(Utils::FilePath::fromString(progFiles + "/CMake/bin"));
const QString progFilesX86 = QLatin1String(qgetenv("ProgramFiles(x86)"));
if (!progFilesX86.isEmpty()) {
path.append(Utils::FileName::fromString(progFilesX86 + "/CMake"));
path.append(Utils::FileName::fromString(progFilesX86 + "/CMake/bin"));
path.append(Utils::FilePath::fromString(progFilesX86 + "/CMake"));
path.append(Utils::FilePath::fromString(progFilesX86 + "/CMake/bin"));
}
}
if (HostOsInfo::isMacHost()) {
path.append(Utils::FileName::fromString("/Applications/CMake.app/Contents/bin"));
path.append(Utils::FileName::fromString("/usr/local/bin"));
path.append(Utils::FileName::fromString("/opt/local/bin"));
path.append(Utils::FilePath::fromString("/Applications/CMake.app/Contents/bin"));
path.append(Utils::FilePath::fromString("/usr/local/bin"));
path.append(Utils::FilePath::fromString("/opt/local/bin"));
}
const QStringList execs = env.appendExeExtensions(QLatin1String("cmake"));
FileNameList suspects;
foreach (const Utils::FileName &base, path) {
FilePathList suspects;
foreach (const Utils::FilePath &base, path) {
if (base.isEmpty())
continue;
@@ -103,12 +103,12 @@ static std::vector<std::unique_ptr<CMakeTool>> autoDetectCMakeTools()
for (const QString &exec : execs) {
fi.setFile(QDir(base.toString()), exec);
if (fi.exists() && fi.isFile() && fi.isExecutable())
suspects << FileName::fromString(fi.absoluteFilePath());
suspects << FilePath::fromString(fi.absoluteFilePath());
}
}
std::vector<std::unique_ptr<CMakeTool>> found;
foreach (const FileName &command, suspects) {
foreach (const FilePath &command, suspects) {
auto item = std::make_unique<CMakeTool>(CMakeTool::AutoDetection, CMakeTool::createId());
item->setCMakeExecutable(command);
item->setDisplayName(CMakeToolManager::tr("System CMake at %1").arg(command.toUserOutput()));
@@ -166,7 +166,7 @@ CMakeToolSettingsAccessor::CMakeToolSettingsAccessor() :
QCoreApplication::translate("CMakeProjectManager::CMakeToolManager", "CMake"),
Core::Constants::IDE_DISPLAY_NAME)
{
setBaseFilePath(FileName::fromString(Core::ICore::userResourcePath() + CMAKE_TOOL_FILENAME));
setBaseFilePath(FilePath::fromString(Core::ICore::userResourcePath() + CMAKE_TOOL_FILENAME));
addVersionUpgrader(std::make_unique<CMakeToolSettingsUpgraderV0>());
}
@@ -175,7 +175,7 @@ CMakeToolSettingsAccessor::CMakeTools CMakeToolSettingsAccessor::restoreCMakeToo
{
CMakeTools result;
const FileName sdkSettingsFile = FileName::fromString(Core::ICore::installerResourcePath()
const FilePath sdkSettingsFile = FilePath::fromString(Core::ICore::installerResourcePath()
+ CMAKE_TOOL_FILENAME);
CMakeTools sdkTools = cmakeTools(restoreSettings(sdkSettingsFile, parent), true);

View File

@@ -28,7 +28,7 @@
namespace CMakeProjectManager {
ConfigModelItemDelegate::ConfigModelItemDelegate(const Utils::FileName &base, QObject* parent)
ConfigModelItemDelegate::ConfigModelItemDelegate(const Utils::FilePath &base, QObject* parent)
: QStyledItemDelegate(parent)
, m_base(base)
{ }
@@ -78,7 +78,7 @@ void ConfigModelItemDelegate::setEditorData(QWidget *editor, const QModelIndex &
ConfigModel::DataItem data = ConfigModel::dataItemFromIndex(index);
if (data.type == ConfigModel::DataItem::FILE || data.type == ConfigModel::DataItem::DIRECTORY) {
auto edit = static_cast<Utils::PathChooser *>(editor);
edit->setFileName(Utils::FileName::fromUserInput(data.value));
edit->setFileName(Utils::FilePath::fromUserInput(data.value));
return;
} else if (!data.values.isEmpty()) {
auto edit = static_cast<QComboBox *>(editor);

View File

@@ -30,7 +30,7 @@ class ConfigModelItemDelegate : public QStyledItemDelegate
Q_OBJECT
public:
ConfigModelItemDelegate(const Utils::FileName &base, QObject *parent = nullptr);
ConfigModelItemDelegate(const Utils::FilePath &base, QObject *parent = nullptr);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const final;
@@ -40,7 +40,7 @@ public:
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const final;
private:
Utils::FileName m_base;
Utils::FilePath m_base;
QComboBox m_measurement;
};

View File

@@ -78,8 +78,8 @@ bool isValid(const QVariant &v)
ServerMode::ServerMode(const Environment &env,
const FileName &sourceDirectory, const FileName &buildDirectory,
const FileName &cmakeExecutable,
const FilePath &sourceDirectory, const FilePath &buildDirectory,
const FilePath &cmakeExecutable,
const QString &generator, const QString &extraGenerator,
const QString &platform, const QString &toolset,
bool experimental, int major, int minor,

View File

@@ -47,8 +47,8 @@ class ServerMode : public QObject
public:
ServerMode(const Utils::Environment &env,
const Utils::FileName &sourceDirectory, const Utils::FileName &buildDirectory,
const Utils::FileName &cmakeExecutable,
const Utils::FilePath &sourceDirectory, const Utils::FilePath &buildDirectory,
const Utils::FilePath &cmakeExecutable,
const QString &generator, const QString &extraGenerator,
const QString &platform, const QString &toolset,
bool experimental, int major, int minor = -1,
@@ -92,9 +92,9 @@ private:
QLocalSocket *m_cmakeSocket = nullptr;
QTimer m_connectionTimer;
Utils::FileName m_sourceDirectory;
Utils::FileName m_buildDirectory;
Utils::FileName m_cmakeExecutable;
Utils::FilePath m_sourceDirectory;
Utils::FilePath m_buildDirectory;
Utils::FilePath m_cmakeExecutable;
QByteArray m_buffer;

View File

@@ -85,7 +85,7 @@ ServerModeReader::ServerModeReader()
Task editable(t);
if (!editable.file.isEmpty()) {
QDir srcDir(m_parameters.sourceDirectory.toString());
editable.file = FileName::fromString(srcDir.absoluteFilePath(editable.file.toString()));
editable.file = FilePath::fromString(srcDir.absoluteFilePath(editable.file.toString()));
}
TaskHub::addTask(editable);
});
@@ -228,7 +228,7 @@ QList<CMakeBuildTarget> ServerModeReader::takeBuildTargets()
const QList<CMakeBuildTarget> result = transform(m_targets, [](const Target *t) -> CMakeBuildTarget {
CMakeBuildTarget ct;
ct.title = t->name;
ct.executable = t->artifacts.isEmpty() ? FileName() : t->artifacts.at(0);
ct.executable = t->artifacts.isEmpty() ? FilePath() : t->artifacts.at(0);
TargetType type = UtilityType;
if (t->type == "EXECUTABLE")
type = ExecutableType;
@@ -245,7 +245,7 @@ QList<CMakeBuildTarget> ServerModeReader::takeBuildTargets()
if (t->artifacts.isEmpty()) {
ct.workingDirectory = t->buildDirectory;
} else {
ct.workingDirectory = Utils::FileName::fromString(t->artifacts.at(0).toFileInfo().absolutePath());
ct.workingDirectory = Utils::FilePath::fromString(t->artifacts.at(0).toFileInfo().absolutePath());
}
ct.sourceDirectory = t->sourceDirectory;
return ct;
@@ -261,7 +261,7 @@ CMakeConfig ServerModeReader::takeParsedConfiguration()
return config;
}
static void addCMakeVFolder(FolderNode *base, const Utils::FileName &basePath, int priority,
static void addCMakeVFolder(FolderNode *base, const Utils::FilePath &basePath, int priority,
const QString &displayName,
std::vector<std::unique_ptr<FileNode>> &&files)
{
@@ -281,7 +281,7 @@ static void addCMakeVFolder(FolderNode *base, const Utils::FileName &basePath, i
}
static std::vector<std::unique_ptr<FileNode>> &&
removeKnownNodes(const QSet<Utils::FileName> &knownFiles,
removeKnownNodes(const QSet<Utils::FilePath> &knownFiles,
std::vector<std::unique_ptr<FileNode>> &&files)
{
Utils::erase(files, [&knownFiles](const std::unique_ptr<FileNode> &n) {
@@ -291,15 +291,15 @@ removeKnownNodes(const QSet<Utils::FileName> &knownFiles,
}
static void addCMakeInputs(FolderNode *root,
const Utils::FileName &sourceDir,
const Utils::FileName &buildDir,
const Utils::FilePath &sourceDir,
const Utils::FilePath &buildDir,
std::vector<std::unique_ptr<FileNode>> &&sourceInputs,
std::vector<std::unique_ptr<FileNode>> &&buildInputs,
std::vector<std::unique_ptr<FileNode>> &&rootInputs)
{
std::unique_ptr<ProjectNode> cmakeVFolder = std::make_unique<CMakeInputsNode>(root->filePath());
QSet<Utils::FileName> knownFiles;
QSet<Utils::FilePath> knownFiles;
root->forEachGenericNode([&knownFiles](const Node *n) {
if (n->listInProject())
knownFiles.insert(n->filePath());
@@ -309,7 +309,7 @@ static void addCMakeInputs(FolderNode *root,
addCMakeVFolder(cmakeVFolder.get(), buildDir, 100,
QCoreApplication::translate("CMakeProjectManager::Internal::ServerModeReader", "<Build Directory>"),
removeKnownNodes(knownFiles, std::move(buildInputs)));
addCMakeVFolder(cmakeVFolder.get(), Utils::FileName(), 10,
addCMakeVFolder(cmakeVFolder.get(), Utils::FilePath(), 10,
QCoreApplication::translate("CMakeProjectManager::Internal::ServerModeReader", "<Other Locations>"),
removeKnownNodes(knownFiles, std::move(rootInputs)));
@@ -326,7 +326,7 @@ void ServerModeReader::generateProjectTree(CMakeProjectNode *root,
std::vector<std::unique_ptr<FileNode>> cmakeLists;
for (std::unique_ptr<FileNode> &fn : m_cmakeInputsFileNodes) {
const FileName path = fn->filePath();
const FilePath path = fn->filePath();
if (path.fileName().compare("CMakeLists.txt", HostOsInfo::fileNameCaseSensitivity()) == 0)
cmakeLists.emplace_back(std::move(fn));
else if (path.isChildOf(m_parameters.workDirectory))
@@ -344,7 +344,7 @@ void ServerModeReader::generateProjectTree(CMakeProjectNode *root,
if (topLevel)
root->setDisplayName(topLevel->name);
QHash<Utils::FileName, ProjectNode *> cmakeListsNodes
QHash<Utils::FilePath, ProjectNode *> cmakeListsNodes
= addCMakeLists(root, std::move(cmakeLists));
QList<FileNode *> knownHeaders;
addProjects(cmakeListsNodes, m_projects, knownHeaders);
@@ -369,7 +369,7 @@ CppTools::RawProjectParts ServerModeReader::createRawProjectParts() const
if (fg->macros.isEmpty()
&& fg->includePaths.isEmpty()
&& !fg->isGenerated
&& Utils::allOf(fg->sources, [](const Utils::FileName &source) {
&& Utils::allOf(fg->sources, [](const Utils::FilePath &source) {
return Node::fileTypeForFileName(source) == FileType::Header;
})) {
qWarning() << "Not reporting all-header file group of target" << fg->target << "to code model.";
@@ -395,7 +395,7 @@ CppTools::RawProjectParts ServerModeReader::createRawProjectParts() const
cxxProjectFlags.commandLineFlags = flags;
rpp.setFlagsForCxx(cxxProjectFlags);
rpp.setFiles(transform(fg->sources, &FileName::toString));
rpp.setFiles(transform(fg->sources, &FilePath::toString));
const bool isExecutable = fg->target->type == "EXECUTABLE";
rpp.setBuildTargetType(isExecutable ? CppTools::ProjectPart::Executable
@@ -457,7 +457,7 @@ void ServerModeReader::handleReply(const QVariantMap &data, const QString &inRep
void ServerModeReader::handleError(const QString &message)
{
TaskHub::addTask(Task::Error, message, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
Utils::FileName(), -1);
Utils::FilePath(), -1);
if (!m_delayedErrorMessage.isEmpty()) {
reportError();
return;
@@ -535,7 +535,7 @@ ServerModeReader::Project *ServerModeReader::extractProjectData(const QVariantMa
{
auto project = new Project;
project->name = data.value(NAME_KEY).toString();
project->sourceDirectory = FileName::fromString(data.value(SOURCE_DIRECTORY_KEY).toString());
project->sourceDirectory = FilePath::fromString(data.value(SOURCE_DIRECTORY_KEY).toString());
const QVariantList targets = data.value("targets").toList();
for (const QVariant &t : targets) {
@@ -562,8 +562,8 @@ ServerModeReader::Target *ServerModeReader::extractTargetData(const QVariantMap
auto target = new Target;
target->project = p;
target->name = targetName;
target->sourceDirectory = FileName::fromString(data.value(SOURCE_DIRECTORY_KEY).toString());
target->buildDirectory = FileName::fromString(data.value("buildDirectory").toString());
target->sourceDirectory = FilePath::fromString(data.value(SOURCE_DIRECTORY_KEY).toString());
target->buildDirectory = FilePath::fromString(data.value("buildDirectory").toString());
target->crossReferences = extractCrossReferences(data.value("crossReferences").toMap());
@@ -571,7 +571,7 @@ ServerModeReader::Target *ServerModeReader::extractTargetData(const QVariantMap
target->type = data.value("type").toString();
const QStringList artifacts = data.value("artifacts").toStringList();
target->artifacts = transform(artifacts, [&srcDir](const QString &a) { return FileName::fromString(srcDir.absoluteFilePath(a)); });
target->artifacts = transform(artifacts, [&srcDir](const QString &a) { return FilePath::fromString(srcDir.absoluteFilePath(a)); });
const QVariantList fileGroups = data.value("fileGroups").toList();
for (const QVariant &fg : fileGroups) {
@@ -599,14 +599,14 @@ ServerModeReader::FileGroup *ServerModeReader::extractFileGroupData(const QVaria
[](const QVariant &i) -> IncludePath* {
const QVariantMap iData = i.toMap();
auto result = new IncludePath;
result->path = FileName::fromString(iData.value("path").toString());
result->path = FilePath::fromString(iData.value("path").toString());
result->isSystem = iData.value("isSystem", false).toBool();
return result;
});
fileGroup->isGenerated = data.value("isGenerated", false).toBool();
fileGroup->sources = transform(data.value(SOURCES_KEY).toStringList(),
[&srcDir](const QString &s) {
return FileName::fromString(QDir::cleanPath(srcDir.absoluteFilePath(s)));
return FilePath::fromString(QDir::cleanPath(srcDir.absoluteFilePath(s)));
});
m_fileGroups.append(fileGroup);
@@ -681,7 +681,7 @@ QList<ServerModeReader::BacktraceItem *> ServerModeReader::extractBacktrace(cons
void ServerModeReader::extractCMakeInputsData(const QVariantMap &data)
{
const FileName src = FileName::fromString(data.value(SOURCE_DIRECTORY_KEY).toString());
const FilePath src = FilePath::fromString(data.value(SOURCE_DIRECTORY_KEY).toString());
QTC_ASSERT(src == m_parameters.sourceDirectory, return);
QDir srcDir(src.toString());
@@ -696,7 +696,7 @@ void ServerModeReader::extractCMakeInputsData(const QVariantMap &data)
const bool isCMake = section.value("isCMake").toBool(); // part of the cmake installation
for (const QString &s : sources) {
const FileName sfn = FileName::fromString(QDir::cleanPath(srcDir.absoluteFilePath(s)));
const FilePath sfn = FilePath::fromString(QDir::cleanPath(srcDir.absoluteFilePath(s)));
const int oldCount = m_cmakeFiles.count();
m_cmakeFiles.insert(sfn);
if (oldCount < m_cmakeFiles.count()) {
@@ -781,19 +781,19 @@ void ServerModeReader::fixTarget(ServerModeReader::Target *target) const
}
}
QHash<Utils::FileName, ProjectNode *>
QHash<Utils::FilePath, ProjectNode *>
ServerModeReader::addCMakeLists(CMakeProjectNode *root,
std::vector<std::unique_ptr<FileNode>> &&cmakeLists)
{
QHash<Utils::FileName, ProjectNode *> cmakeListsNodes;
QHash<Utils::FilePath, ProjectNode *> cmakeListsNodes;
cmakeListsNodes.insert(root->filePath(), root);
const QSet<Utils::FileName> cmakeDirs
const QSet<Utils::FilePath> cmakeDirs
= Utils::transform<QSet>(cmakeLists, [](const std::unique_ptr<FileNode> &n) {
return n->filePath().parentDir();
});
root->addNestedNodes(std::move(cmakeLists), Utils::FileName(),
[&cmakeDirs, &cmakeListsNodes](const Utils::FileName &fp)
root->addNestedNodes(std::move(cmakeLists), Utils::FilePath(),
[&cmakeDirs, &cmakeListsNodes](const Utils::FilePath &fp)
-> std::unique_ptr<ProjectExplorer::FolderNode> {
if (cmakeDirs.contains(fp)) {
auto fn = std::make_unique<CMakeListsNode>(fp);
@@ -807,13 +807,13 @@ ServerModeReader::addCMakeLists(CMakeProjectNode *root,
return cmakeListsNodes;
}
static void createProjectNode(const QHash<Utils::FileName, ProjectNode *> &cmakeListsNodes,
const Utils::FileName &dir, const QString &displayName)
static void createProjectNode(const QHash<Utils::FilePath, ProjectNode *> &cmakeListsNodes,
const Utils::FilePath &dir, const QString &displayName)
{
ProjectNode *cmln = cmakeListsNodes.value(dir);
QTC_ASSERT(cmln, qDebug() << dir.toUserOutput(); return);
const Utils::FileName projectName = dir.pathAppended(".project::" + displayName);
const Utils::FilePath projectName = dir.pathAppended(".project::" + displayName);
ProjectNode *pn = cmln->projectNode(projectName);
if (!pn) {
@@ -824,7 +824,7 @@ static void createProjectNode(const QHash<Utils::FileName, ProjectNode *> &cmake
pn->setDisplayName(displayName);
}
void ServerModeReader::addProjects(const QHash<Utils::FileName, ProjectNode *> &cmakeListsNodes,
void ServerModeReader::addProjects(const QHash<Utils::FilePath, ProjectNode *> &cmakeListsNodes,
const QList<Project *> &projects,
QList<FileNode *> &knownHeaderNodes)
{
@@ -834,8 +834,8 @@ void ServerModeReader::addProjects(const QHash<Utils::FileName, ProjectNode *> &
}
}
static CMakeTargetNode *createTargetNode(const QHash<Utils::FileName, ProjectNode *> &cmakeListsNodes,
const Utils::FileName &dir, const QString &displayName)
static CMakeTargetNode *createTargetNode(const QHash<Utils::FilePath, ProjectNode *> &cmakeListsNodes,
const Utils::FilePath &dir, const QString &displayName)
{
ProjectNode *cmln = cmakeListsNodes.value(dir);
QTC_ASSERT(cmln, return nullptr);
@@ -854,7 +854,7 @@ static CMakeTargetNode *createTargetNode(const QHash<Utils::FileName, ProjectNod
return tn;
}
void ServerModeReader::addTargets(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
void ServerModeReader::addTargets(const QHash<Utils::FilePath, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
const QList<Target *> &targets,
QList<ProjectExplorer::FileNode *> &knownHeaderNodes)
{
@@ -864,12 +864,12 @@ 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.pathAppended("CMakeLists.txt");
FilePath targetPath = t->sourceDirectory.pathAppended("CMakeLists.txt");
for (CrossReference *cr : qAsConst(t->crossReferences)) {
BacktraceItem *bt = cr->backtrace.isEmpty() ? nullptr : cr->backtrace.at(0);
if (bt) {
const QString btName = bt->name.toLower();
const FileName path = Utils::FileName::fromUserInput(bt->path);
const FilePath path = Utils::FilePath::fromUserInput(bt->path);
QString dn;
if (cr->type != CrossReference::TARGET) {
if (path == targetPath) {
@@ -896,27 +896,27 @@ void ServerModeReader::addTargets(const QHash<Utils::FileName, ProjectExplorer::
}
void ServerModeReader::addFileGroups(ProjectNode *targetRoot,
const Utils::FileName &sourceDirectory,
const Utils::FileName &buildDirectory,
const Utils::FilePath &sourceDirectory,
const Utils::FilePath &buildDirectory,
const QList<ServerModeReader::FileGroup *> &fileGroups,
QList<FileNode *> &knownHeaderNodes)
{
std::vector<std::unique_ptr<FileNode>> toList;
QSet<Utils::FileName> alreadyListed;
QSet<Utils::FilePath> alreadyListed;
// Files already added by other configurations:
targetRoot->forEachGenericNode([&alreadyListed](const Node *n) {
alreadyListed.insert(n->filePath());
});
for (const FileGroup *f : fileGroups) {
const QList<FileName> newSources = Utils::filtered(f->sources, [&alreadyListed](const Utils::FileName &fn) {
const QList<FilePath> newSources = Utils::filtered(f->sources, [&alreadyListed](const Utils::FilePath &fn) {
const int count = alreadyListed.count();
alreadyListed.insert(fn);
return count != alreadyListed.count();
});
std::vector<std::unique_ptr<FileNode>> newFileNodes
= Utils::transform<std::vector>(newSources,
[f, &knownHeaderNodes](const Utils::FileName &fn) {
[f, &knownHeaderNodes](const Utils::FilePath &fn) {
auto node = std::make_unique<FileNode>(fn, Node::fileTypeForFileName(fn));
node->setIsGenerated(f->isGenerated);
if (node->fileType() == FileType::Header)
@@ -942,7 +942,7 @@ void ServerModeReader::addFileGroups(ProjectNode *targetRoot,
addCMakeVFolder(targetRoot, sourceDirectory, 1000, QString(), std::move(sourceFileNodes));
addCMakeVFolder(targetRoot, buildDirectory, 100, tr("<Build Directory>"), std::move(buildFileNodes));
addCMakeVFolder(targetRoot, Utils::FileName(), 10, tr("<Other Locations>"), std::move(otherFileNodes));
addCMakeVFolder(targetRoot, Utils::FilePath(), 10, tr("<Other Locations>"), std::move(otherFileNodes));
}
void ServerModeReader::addHeaderNodes(ProjectNode *root, const QList<FileNode *> knownHeaders,
@@ -959,7 +959,7 @@ void ServerModeReader::addHeaderNodes(ProjectNode *root, const QList<FileNode *>
headerNode->setIcon(headerNodeIcon);
// knownHeaders are already listed in their targets:
QSet<Utils::FileName> seenHeaders = Utils::transform<QSet>(knownHeaders, &FileNode::filePath);
QSet<Utils::FilePath> seenHeaders = Utils::transform<QSet>(knownHeaders, &FileNode::filePath);
// Add scanned headers:
for (const FileNode *fn : allFiles) {

View File

@@ -78,7 +78,7 @@ private:
struct Project;
struct IncludePath {
Utils::FileName path;
Utils::FilePath path;
bool isSystem;
};
@@ -90,7 +90,7 @@ private:
ProjectExplorer::Macros macros;
QList<IncludePath *> includePaths;
QString language;
QList<Utils::FileName> sources;
QList<Utils::FilePath> sources;
bool isGenerated;
};
@@ -118,9 +118,9 @@ private:
Project *project = nullptr;
QString name;
QString type;
QList<Utils::FileName> artifacts;
Utils::FileName sourceDirectory;
Utils::FileName buildDirectory;
QList<Utils::FilePath> artifacts;
Utils::FilePath sourceDirectory;
Utils::FilePath buildDirectory;
QList<FileGroup *> fileGroups;
QList<CrossReference *> crossReferences;
};
@@ -128,7 +128,7 @@ private:
struct Project {
~Project() { qDeleteAll(targets); targets.clear(); }
QString name;
Utils::FileName sourceDirectory;
Utils::FilePath sourceDirectory;
QList<Target *> targets;
};
@@ -145,17 +145,17 @@ private:
void fixTarget(Target *target) const;
QHash<Utils::FileName, ProjectExplorer::ProjectNode *>
QHash<Utils::FilePath, ProjectExplorer::ProjectNode *>
addCMakeLists(CMakeProjectNode *root, std::vector<std::unique_ptr<ProjectExplorer::FileNode> > &&cmakeLists);
void addProjects(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
void addProjects(const QHash<Utils::FilePath, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
const QList<Project *> &projects,
QList<ProjectExplorer::FileNode *> &knownHeaderNodes);
void addTargets(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
void addTargets(const QHash<Utils::FilePath, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
const QList<Target *> &targets,
QList<ProjectExplorer::FileNode *> &knownHeaderNodes);
void addFileGroups(ProjectExplorer::ProjectNode *targetRoot,
const Utils::FileName &sourceDirectory,
const Utils::FileName &buildDirectory, const QList<FileGroup *> &fileGroups,
const Utils::FilePath &sourceDirectory,
const Utils::FilePath &buildDirectory, const QList<FileGroup *> &fileGroups,
QList<ProjectExplorer::FileNode *> &knowHeaderNodes);
void addHeaderNodes(ProjectExplorer::ProjectNode *root,
@@ -172,7 +172,7 @@ private:
CMakeConfig m_cmakeConfiguration;
QSet<Utils::FileName> m_cmakeFiles;
QSet<Utils::FilePath> m_cmakeFiles;
std::vector<std::unique_ptr<ProjectExplorer::FileNode>> m_cmakeInputsFileNodes;
QList<Project *> m_projects;

View File

@@ -70,7 +70,7 @@ namespace Internal {
class CMakeFile : public IDocument
{
public:
CMakeFile(TeaLeafReader *r, const FileName &fileName);
CMakeFile(TeaLeafReader *r, const FilePath &fileName);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
@@ -79,7 +79,7 @@ private:
TeaLeafReader *m_reader;
};
CMakeFile::CMakeFile(TeaLeafReader *r, const FileName &fileName) : m_reader(r)
CMakeFile::CMakeFile(TeaLeafReader *r, const FilePath &fileName) : m_reader(r)
{
setId("Cmake.ProjectFile");
setMimeType(Constants::CMAKEPROJECTMIMETYPE);
@@ -200,7 +200,7 @@ void TeaLeafReader::parse(bool forceConfiguration)
}
const bool mustUpdate = m_cmakeFiles.isEmpty()
|| anyOf(m_cmakeFiles, [&cbpFileFi](const FileName &f) {
|| anyOf(m_cmakeFiles, [&cbpFileFi](const FilePath &f) {
return f.toFileInfo().lastModified() > cbpFileFi.lastModified();
});
if (mustUpdate) {
@@ -235,7 +235,7 @@ QList<CMakeBuildTarget> TeaLeafReader::takeBuildTargets()
CMakeConfig TeaLeafReader::takeParsedConfiguration()
{
const FileName cacheFile = m_parameters.workDirectory.pathAppended("CMakeCache.txt");
const FilePath cacheFile = m_parameters.workDirectory.pathAppended("CMakeCache.txt");
if (!cacheFile.exists())
return { };
@@ -248,10 +248,10 @@ CMakeConfig TeaLeafReader::takeParsedConfiguration()
return { };
}
const FileName sourceOfBuildDir
= FileName::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", result));
const FileName canonicalSourceOfBuildDir = sourceOfBuildDir.canonicalPath();
const FileName canonicalSourceDirectory = m_parameters.sourceDirectory.canonicalPath();
const FilePath sourceOfBuildDir
= FilePath::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", result));
const FilePath canonicalSourceOfBuildDir = sourceOfBuildDir.canonicalPath();
const FilePath canonicalSourceDirectory = m_parameters.sourceDirectory.canonicalPath();
if (canonicalSourceOfBuildDir != canonicalSourceDirectory) { // Uses case-insensitive compare where appropriate
emit errorOccured(tr("The build directory is not for %1 but for %2")
.arg(canonicalSourceOfBuildDir.toUserOutput(),
@@ -269,10 +269,10 @@ void TeaLeafReader::generateProjectTree(CMakeProjectNode *root, const QList<cons
root->setDisplayName(m_projectName);
// Delete no longer necessary file watcher based on m_cmakeFiles:
const QSet<FileName> currentWatched
const QSet<FilePath> currentWatched
= transform(m_watchedFiles, &CMakeFile::filePath);
const QSet<FileName> toWatch = m_cmakeFiles;
QSet<FileName> toDelete = currentWatched;
const QSet<FilePath> toWatch = m_cmakeFiles;
QSet<FilePath> toDelete = currentWatched;
toDelete.subtract(toWatch);
m_watchedFiles = filtered(m_watchedFiles, [&toDelete](Internal::CMakeFile *cmf) {
if (toDelete.contains(cmf->filePath())) {
@@ -283,30 +283,30 @@ void TeaLeafReader::generateProjectTree(CMakeProjectNode *root, const QList<cons
});
// Add new file watchers:
QSet<FileName> toAdd = toWatch;
QSet<FilePath> toAdd = toWatch;
toAdd.subtract(currentWatched);
foreach (const FileName &fn, toAdd) {
foreach (const FilePath &fn, toAdd) {
auto cm = new CMakeFile(this, fn);
DocumentManager::addDocument(cm);
m_watchedFiles.insert(cm);
}
QSet<FileName> allIncludePathSet;
QSet<FilePath> allIncludePathSet;
for (const CMakeBuildTarget &bt : m_buildTargets) {
const QList<Utils::FileName> targetIncludePaths
= Utils::filtered(bt.includeFiles, [this](const Utils::FileName &fn) {
const QList<Utils::FilePath> targetIncludePaths
= Utils::filtered(bt.includeFiles, [this](const Utils::FilePath &fn) {
return fn.isChildOf(m_parameters.sourceDirectory);
});
allIncludePathSet.unite(QSet<FileName>::fromList(targetIncludePaths));
allIncludePathSet.unite(QSet<FilePath>::fromList(targetIncludePaths));
}
const QList<FileName> allIncludePaths = allIncludePathSet.toList();
const QList<FilePath> allIncludePaths = allIncludePathSet.toList();
const QList<const FileNode *> missingHeaders
= Utils::filtered(allFiles, [&allIncludePaths](const FileNode *fn) -> bool {
if (fn->fileType() != FileType::Header)
return false;
return Utils::contains(allIncludePaths, [fn](const FileName &inc) { return fn->filePath().isChildOf(inc); });
return Utils::contains(allIncludePaths, [fn](const FilePath &inc) { return fn->filePath().isChildOf(inc); });
});
// filter duplicates:
@@ -327,15 +327,15 @@ void TeaLeafReader::generateProjectTree(CMakeProjectNode *root, const QList<cons
}
static void processCMakeIncludes(const CMakeBuildTarget &cbt, const ToolChain *tc,
const QStringList& flags, const FileName &sysroot,
QSet<FileName> &tcIncludes, QStringList &includePaths)
const QStringList& flags, const FilePath &sysroot,
QSet<FilePath> &tcIncludes, QStringList &includePaths)
{
if (!tc)
return;
foreach (const HeaderPath &hp, tc->builtInHeaderPaths(flags, sysroot))
tcIncludes.insert(FileName::fromString(hp.path));
foreach (const FileName &i, cbt.includeFiles) {
tcIncludes.insert(FilePath::fromString(hp.path));
foreach (const FilePath &i, cbt.includeFiles) {
if (!tcIncludes.contains(i))
includePaths.append(i.toString());
}
@@ -345,7 +345,7 @@ CppTools::RawProjectParts TeaLeafReader::createRawProjectParts() const
{
const ToolChain *tcCxx = ToolChainManager::findToolChain(m_parameters.cxxToolChainId);
const ToolChain *tcC = ToolChainManager::findToolChain(m_parameters.cToolChainId);
const FileName sysroot = m_parameters.sysRoot;
const FilePath sysroot = m_parameters.sysRoot;
CppTools::RawProjectParts rpps;
QHash<QString, QStringList> targetDataCacheCxx;
@@ -359,13 +359,13 @@ CppTools::RawProjectParts TeaLeafReader::createRawProjectParts() const
// place.
auto cxxflags = getFlagsFor(cbt, targetDataCacheCxx, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
auto cflags = getFlagsFor(cbt, targetDataCacheC, ProjectExplorer::Constants::C_LANGUAGE_ID);
QSet<FileName> tcIncludes;
QSet<FilePath> tcIncludes;
QStringList includePaths;
if (tcCxx || tcC) {
processCMakeIncludes(cbt, tcCxx, cxxflags, sysroot, tcIncludes, includePaths);
processCMakeIncludes(cbt, tcC, cflags, sysroot, tcIncludes, includePaths);
} else {
includePaths = transform(cbt.includeFiles, &FileName::toString);
includePaths = transform(cbt.includeFiles, &FilePath::toString);
}
includePaths += m_parameters.workDirectory.toString();
CppTools::RawProjectPart rpp;
@@ -383,7 +383,7 @@ CppTools::RawProjectParts TeaLeafReader::createRawProjectParts() const
rpp.setMacros(cbt.macros);
rpp.setDisplayName(cbt.title);
rpp.setFiles(transform(cbt.files, &FileName::toString));
rpp.setFiles(transform(cbt.files, &FilePath::toString));
const bool isExecutable = cbt.targetType == ExecutableType;
rpp.setBuildTargetType(isExecutable ? CppTools::ProjectPart::Executable
@@ -414,9 +414,9 @@ void TeaLeafReader::extractData()
CMakeTool *cmake = m_parameters.cmakeTool();
QTC_ASSERT(m_parameters.isValid() && cmake, return);
const FileName srcDir = m_parameters.sourceDirectory;
const FileName bldDir = m_parameters.workDirectory;
const FileName topCMake = srcDir.pathAppended("CMakeLists.txt");
const FilePath srcDir = m_parameters.sourceDirectory;
const FilePath bldDir = m_parameters.workDirectory;
const FilePath topCMake = srcDir.pathAppended("CMakeLists.txt");
resetData();
@@ -425,13 +425,13 @@ void TeaLeafReader::extractData()
// Do not insert topCMake into m_cmakeFiles: The project already watches that!
// Find cbp file
FileName cbpFile = FileName::fromString(findCbpFile(bldDir.toString()));
FilePath cbpFile = FilePath::fromString(findCbpFile(bldDir.toString()));
if (cbpFile.isEmpty())
return;
m_cmakeFiles.insert(cbpFile);
// Add CMakeCache.txt file:
const FileName cacheFile = m_parameters.workDirectory.pathAppended("CMakeCache.txt");
const FilePath cacheFile = m_parameters.workDirectory.pathAppended("CMakeCache.txt");
if (cacheFile.exists())
m_cmakeFiles.insert(cacheFile);
@@ -466,7 +466,7 @@ void TeaLeafReader::startCMake(const QStringList &configurationArguments)
CMakeTool *cmake = m_parameters.cmakeTool();
QTC_ASSERT(m_parameters.isValid() && cmake, return);
const FileName workDirectory = m_parameters.workDirectory;
const FilePath workDirectory = m_parameters.workDirectory;
QTC_ASSERT(!m_cmakeProcess, return);
QTC_ASSERT(!m_parser, return);
QTC_ASSERT(!m_future, return);
@@ -482,7 +482,7 @@ void TeaLeafReader::startCMake(const QStringList &configurationArguments)
TaskHub::addTask(task);
} else {
Task t = task;
t.file = FileName::fromString(source.absoluteFilePath(task.file.toString()));
t.file = FilePath::fromString(source.absoluteFilePath(task.file.toString()));
TaskHub::addTask(t);
}
});

View File

@@ -79,7 +79,7 @@ private:
ProjectExplorer::IOutputParser *m_parser = nullptr;
QFutureInterface<void> *m_future = nullptr;
QSet<Utils::FileName> m_cmakeFiles;
QSet<Utils::FilePath> m_cmakeFiles;
QString m_projectName;
QList<CMakeBuildTarget> m_buildTargets;
std::vector<std::unique_ptr<ProjectExplorer::FileNode>> m_files;