ICore: Change some path API to use FilePath

Change-Id: Id841d6177206a021c9e606ce560b47d1ae6e52b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2021-04-22 16:15:26 +02:00
parent b2c0554733
commit c1f90aeca2
79 changed files with 260 additions and 244 deletions

View File

@@ -890,6 +890,11 @@ QVariant FilePath::toVariant() const
return m_data; return m_data;
} }
QDir FilePath::toDir() const
{
return QDir(m_data);
}
bool FilePath::operator==(const FilePath &other) const bool FilePath::operator==(const FilePath &other) const
{ {
if (!m_url.isEmpty()) if (!m_url.isEmpty())

View File

@@ -81,6 +81,7 @@ public:
QString toString() const; QString toString() const;
QFileInfo toFileInfo() const; QFileInfo toFileInfo() const;
QVariant toVariant() const; QVariant toVariant() const;
QDir toDir() const;
QString toUserOutput() const; QString toUserOutput() const;
QString shortNativePath() const; QString shortNativePath() const;

View File

@@ -91,7 +91,7 @@ static Q_LOGGING_CATEGORY(avdConfigLog, "qtc.android.androidconfig", QtWarningMs
namespace Android { namespace Android {
using namespace Internal; using namespace Internal;
const char JsonFilePath[] = "/android/sdk_definitions.json"; const char JsonFilePath[] = "android/sdk_definitions.json";
const char SdkToolsUrlKey[] = "sdk_tools_url"; const char SdkToolsUrlKey[] = "sdk_tools_url";
const char CommonKey[] = "common"; const char CommonKey[] = "common";
const char SdkEssentialPkgsKey[] = "sdk_essential_packages"; const char SdkEssentialPkgsKey[] = "sdk_essential_packages";
@@ -142,7 +142,7 @@ namespace {
static QString sdkSettingsFileName() static QString sdkSettingsFileName()
{ {
return Core::ICore::installerResourcePath() + "/android.xml"; return Core::ICore::installerResourcePath().pathAppended("android.xml").toString();
} }
static bool is32BitUserSpace() static bool is32BitUserSpace()
@@ -270,21 +270,22 @@ void AndroidConfig::save(QSettings &settings) const
void AndroidConfig::parseDependenciesJson() void AndroidConfig::parseDependenciesJson()
{ {
QString sdkConfigUserFile(Core::ICore::userResourcePath() + JsonFilePath); FilePath sdkConfigUserFile(Core::ICore::userResourcePath() / JsonFilePath);
QString sdkConfigFile(Core::ICore::resourcePath() + JsonFilePath); FilePath sdkConfigFile(Core::ICore::resourcePath() / JsonFilePath);
if (!QFile::exists(sdkConfigUserFile)) { if (!sdkConfigUserFile.exists()) {
QDir(QFileInfo(sdkConfigUserFile).absolutePath()).mkpath("."); QDir(sdkConfigUserFile.toFileInfo().absolutePath()).mkpath(".");
QFile::copy(sdkConfigFile, sdkConfigUserFile); QFile::copy(sdkConfigFile.toString(), sdkConfigUserFile.toString());
} }
if (QFileInfo(sdkConfigFile).lastModified() > QFileInfo(sdkConfigUserFile).lastModified()) { if (sdkConfigFile.toFileInfo().lastModified() > sdkConfigUserFile.toFileInfo().lastModified()) {
QFile::remove(sdkConfigUserFile + ".old"); const QString oldUserFile = (sdkConfigUserFile + ".old").toString();
QFile::rename(sdkConfigUserFile, sdkConfigUserFile + ".old"); QFile::remove(oldUserFile);
QFile::copy(sdkConfigFile, sdkConfigUserFile); QFile::rename(sdkConfigUserFile.toString(), oldUserFile);
QFile::copy(sdkConfigFile.toString(), sdkConfigUserFile.toString());
} }
QFile jsonFile(sdkConfigUserFile); QFile jsonFile(sdkConfigUserFile.toString());
if (!jsonFile.open(QIODevice::ReadOnly)) { if (!jsonFile.open(QIODevice::ReadOnly)) {
qCDebug(avdConfigLog, "Couldn't open JSON config file %s.", qPrintable(jsonFile.fileName())); qCDebug(avdConfigLog, "Couldn't open JSON config file %s.", qPrintable(jsonFile.fileName()));
return; return;

View File

@@ -54,14 +54,14 @@ namespace Internal {
const char dataKeyC[] = "DebugServerProvider."; const char dataKeyC[] = "DebugServerProvider.";
const char countKeyC[] = "DebugServerProvider.Count"; const char countKeyC[] = "DebugServerProvider.Count";
const char fileVersionKeyC[] = "Version"; const char fileVersionKeyC[] = "Version";
const char fileNameKeyC[] = "/debugserverproviders.xml"; const char fileNameKeyC[] = "debugserverproviders.xml";
static DebugServerProviderManager *m_instance = nullptr; static DebugServerProviderManager *m_instance = nullptr;
// DebugServerProviderManager // DebugServerProviderManager
DebugServerProviderManager::DebugServerProviderManager() DebugServerProviderManager::DebugServerProviderManager()
: m_configFile(Utils::FilePath::fromString(Core::ICore::userResourcePath() + fileNameKeyC)) : m_configFile(Core::ICore::userResourcePath() / fileNameKeyC)
, m_factories({new GenericGdbServerProviderFactory, , m_factories({new GenericGdbServerProviderFactory,
new JLinkGdbServerProviderFactory, new JLinkGdbServerProviderFactory,
new OpenOcdGdbServerProviderFactory, new OpenOcdGdbServerProviderFactory,

View File

@@ -47,11 +47,13 @@ const char COMMAND[] = "command";
const char SUPPORTED_MIME[] = "supportedMime"; const char SUPPORTED_MIME[] = "supportedMime";
} }
AbstractSettings::AbstractSettings(const QString &name, const QString &ending) : AbstractSettings::AbstractSettings(const QString &name, const QString &ending)
m_ending(ending), : m_ending(ending)
m_styleDir(Core::ICore::userResourcePath() + '/' + Beautifier::Constants::SETTINGS_DIRNAME , m_styleDir(Core::ICore::userResourcePath()
+ '/' + name), .pathAppended(Beautifier::Constants::SETTINGS_DIRNAME)
m_name(name) .pathAppended(name)
.toString())
, m_name(name)
{ {
} }

View File

@@ -171,9 +171,10 @@ void ArtisticStyleSettings::setCustomStyle(const QString &customStyle)
QString ArtisticStyleSettings::documentationFilePath() const QString ArtisticStyleSettings::documentationFilePath() const
{ {
return Core::ICore::userResourcePath() + '/' + Beautifier::Constants::SETTINGS_DIRNAME + '/' return (Core::ICore::userResourcePath() / Beautifier::Constants::SETTINGS_DIRNAME
+ Beautifier::Constants::DOCUMENTATION_DIRNAME + '/' / Beautifier::Constants::DOCUMENTATION_DIRNAME / SETTINGS_NAME
+ SETTINGS_NAME + ".xml"; + ".xml")
.toString();
} }
void ArtisticStyleSettings::createDocumentationFile() const void ArtisticStyleSettings::createDocumentationFile() const

View File

@@ -56,9 +56,10 @@ ClangFormatSettings::ClangFormatSettings() :
QString ClangFormatSettings::documentationFilePath() const QString ClangFormatSettings::documentationFilePath() const
{ {
return Core::ICore::userResourcePath() + '/' + Beautifier::Constants::SETTINGS_DIRNAME + '/' return (Core::ICore::userResourcePath() / Beautifier::Constants::SETTINGS_DIRNAME
+ Beautifier::Constants::DOCUMENTATION_DIRNAME + '/' / Beautifier::Constants::DOCUMENTATION_DIRNAME / SETTINGS_NAME
+ SETTINGS_NAME + ".xml"; + ".xml")
.toString();
} }
void ClangFormatSettings::createDocumentationFile() const void ClangFormatSettings::createDocumentationFile() const

View File

@@ -140,9 +140,10 @@ void UncrustifySettings::setFormatEntireFileFallback(bool formatEntireFileFallba
QString UncrustifySettings::documentationFilePath() const QString UncrustifySettings::documentationFilePath() const
{ {
return Core::ICore::userResourcePath() + '/' + Beautifier::Constants::SETTINGS_DIRNAME + '/' return (Core::ICore::userResourcePath() / Beautifier::Constants::SETTINGS_DIRNAME
+ Beautifier::Constants::DOCUMENTATION_DIRNAME + '/' / Beautifier::Constants::DOCUMENTATION_DIRNAME / SETTINGS_NAME
+ SETTINGS_NAME + ".xml"; + ".xml")
.toString();
} }
void UncrustifySettings::createDocumentationFile() const void UncrustifySettings::createDocumentationFile() const

View File

@@ -64,7 +64,7 @@ enum { backEndStartTimeOutInMs = 10000 };
static QString backendProcessPath() static QString backendProcessPath()
{ {
return Core::ICore::libexecPath() + "/clangbackend" + QTC_HOST_EXE_SUFFIX; return (Core::ICore::libexecPath() / "clangbackend" + QTC_HOST_EXE_SUFFIX).toString();
} }
namespace ClangCodeModel { namespace ClangCodeModel {

View File

@@ -173,8 +173,7 @@ void ClangFormatConfigWidget::initChecksAndPreview()
connect(m_ui->applyButton, &QPushButton::clicked, this, &ClangFormatConfigWidget::apply); connect(m_ui->applyButton, &QPushButton::clicked, this, &ClangFormatConfigWidget::apply);
fileName = m_project->projectFilePath().pathAppended("snippet.cpp"); fileName = m_project->projectFilePath().pathAppended("snippet.cpp");
} else { } else {
fileName = Utils::FilePath::fromString(Core::ICore::userResourcePath()) fileName = Core::ICore::userResourcePath() / "snippet.cpp";
.pathAppended("snippet.cpp");
} }
m_preview->textDocument()->indenter()->setFileName(fileName); m_preview->textDocument()->indenter()->setFileName(fileName);
} }
@@ -240,10 +239,10 @@ void ClangFormatConfigWidget::showGlobalCheckboxes()
static bool projectConfigExists() static bool projectConfigExists()
{ {
return Utils::FilePath::fromString(Core::ICore::userResourcePath()) return Core::ICore::userResourcePath()
.pathAppended("clang-format") .pathAppended("clang-format")
.pathAppended(currentProjectUniqueId()) .pathAppended(currentProjectUniqueId())
.pathAppended((Constants::SETTINGS_FILE_NAME)) .pathAppended(Constants::SETTINGS_FILE_NAME)
.exists(); .exists();
} }
@@ -478,7 +477,7 @@ void ClangFormatConfigWidget::apply()
void ClangFormatConfigWidget::saveConfig(const std::string &text) const void ClangFormatConfigWidget::saveConfig(const std::string &text) const
{ {
QString filePath = Core::ICore::userResourcePath(); QString filePath = Core::ICore::userResourcePath().toString();
if (m_project) if (m_project)
filePath += "/clang-format/" + currentProjectUniqueId(); filePath += "/clang-format/" + currentProjectUniqueId();
filePath += "/" + QLatin1String(Constants::SETTINGS_FILE_NAME); filePath += "/" + QLatin1String(Constants::SETTINGS_FILE_NAME);

View File

@@ -192,7 +192,7 @@ static bool useProjectOverriddenSettings()
static Utils::FilePath globalPath() static Utils::FilePath globalPath()
{ {
return Utils::FilePath::fromString(Core::ICore::userResourcePath()); return Core::ICore::userResourcePath();
} }
static Utils::FilePath projectPath() static Utils::FilePath projectPath()

View File

@@ -65,8 +65,7 @@ public:
static const char CMAKE_TOOL_COUNT_KEY[] = "CMakeTools.Count"; static const char CMAKE_TOOL_COUNT_KEY[] = "CMakeTools.Count";
static const char CMAKE_TOOL_DATA_KEY[] = "CMakeTools."; static const char CMAKE_TOOL_DATA_KEY[] = "CMakeTools.";
static const char CMAKE_TOOL_DEFAULT_KEY[] = "CMakeTools.Default"; static const char CMAKE_TOOL_DEFAULT_KEY[] = "CMakeTools.Default";
static const char CMAKE_TOOL_FILENAME[] = "/cmaketools.xml"; static const char CMAKE_TOOL_FILENAME[] = "cmaketools.xml";
static std::vector<std::unique_ptr<CMakeTool>> autoDetectCMakeTools() static std::vector<std::unique_ptr<CMakeTool>> autoDetectCMakeTools()
{ {
@@ -165,7 +164,7 @@ CMakeToolSettingsAccessor::CMakeToolSettingsAccessor() :
QCoreApplication::translate("CMakeProjectManager::CMakeToolManager", "CMake"), QCoreApplication::translate("CMakeProjectManager::CMakeToolManager", "CMake"),
Core::Constants::IDE_DISPLAY_NAME) Core::Constants::IDE_DISPLAY_NAME)
{ {
setBaseFilePath(FilePath::fromString(Core::ICore::userResourcePath() + CMAKE_TOOL_FILENAME)); setBaseFilePath(Core::ICore::userResourcePath() / CMAKE_TOOL_FILENAME);
addVersionUpgrader(std::make_unique<CMakeToolSettingsUpgraderV0>()); addVersionUpgrader(std::make_unique<CMakeToolSettingsUpgraderV0>());
} }
@@ -174,8 +173,7 @@ CMakeToolSettingsAccessor::CMakeTools CMakeToolSettingsAccessor::restoreCMakeToo
{ {
CMakeTools result; CMakeTools result;
const FilePath sdkSettingsFile = FilePath::fromString(Core::ICore::installerResourcePath() const FilePath sdkSettingsFile = Core::ICore::installerResourcePath() / CMAKE_TOOL_FILENAME;
+ CMAKE_TOOL_FILENAME);
CMakeTools sdkTools = cmakeTools(restoreSettings(sdkSettingsFile, parent), true); CMakeTools sdkTools = cmakeTools(restoreSettings(sdkSettingsFile, parent), true);

View File

@@ -225,7 +225,7 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
expander->registerVariable("IDE:ResourcePath", expander->registerVariable("IDE:ResourcePath",
tr("The directory where %1 finds its pre-installed resources.") tr("The directory where %1 finds its pre-installed resources.")
.arg(Constants::IDE_DISPLAY_NAME), .arg(Constants::IDE_DISPLAY_NAME),
[]() { return ICore::resourcePath(); }); []() { return ICore::resourcePath().toString(); });
expander->registerPrefix("CurrentDate:", tr("The current date (QDate formatstring)."), expander->registerPrefix("CurrentDate:", tr("The current date (QDate formatstring)."),
[](const QString &fmt) { return QDate::currentDate().toString(fmt); }); [](const QString &fmt) { return QDate::currentDate().toString(fmt); });
expander->registerPrefix("CurrentTime:", tr("The current time (QTime formatstring)."), expander->registerPrefix("CurrentTime:", tr("The current time (QTime formatstring)."),

View File

@@ -632,23 +632,22 @@ void ExternalToolConfig::showInfoForItem(const QModelIndex &index)
static QString getUserFilePath(const QString &proposalFileName) static QString getUserFilePath(const QString &proposalFileName)
{ {
const QDir resourceDir(ICore::userResourcePath()); const QDir resourceDir(ICore::userResourcePath().toDir());
if (!resourceDir.exists(QLatin1String("externaltools"))) if (!resourceDir.exists(QLatin1String("externaltools")))
resourceDir.mkpath(QLatin1String("externaltools")); resourceDir.mkpath(QLatin1String("externaltools"));
const QFileInfo fi(proposalFileName); const QFileInfo fi(proposalFileName);
const QString &suffix = QLatin1Char('.') + fi.completeSuffix(); const QString &suffix = QLatin1Char('.') + fi.completeSuffix();
const QString &newFilePath = ICore::userResourcePath() const FilePath newFilePath = ICore::userResourcePath() / "externaltools" / fi.baseName();
+ QLatin1String("/externaltools/") + fi.baseName();
int count = 0; int count = 0;
QString tryPath = newFilePath + suffix; FilePath tryPath = newFilePath + suffix;
while (QFile::exists(tryPath)) { while (tryPath.exists()) {
if (++count > 15) if (++count > 15)
return QString(); return QString();
// add random number // add random number
const int number = QRandomGenerator::global()->generate() % 1000; const int number = QRandomGenerator::global()->generate() % 1000;
tryPath = newFilePath + QString::number(number) + suffix; tryPath = newFilePath + QString::number(number) + suffix;
} }
return tryPath; return tryPath.toString();
} }
static QString idFromDisplayName(const QString &displayName) static QString idFromDisplayName(const QString &displayName)

View File

@@ -145,6 +145,11 @@ static bool isTextKeySequence(const QKeySequence &sequence)
return false; return false;
} }
static FilePath schemesPath()
{
return Core::ICore::resourcePath() / "schemes";
}
namespace Core { namespace Core {
namespace Internal { namespace Internal {
@@ -485,9 +490,10 @@ void ShortcutSettingsWidget::resetToDefault()
void ShortcutSettingsWidget::importAction() void ShortcutSettingsWidget::importAction()
{ {
QString fileName = QFileDialog::getOpenFileName(ICore::dialogParent(), tr("Import Keyboard Mapping Scheme"), QString fileName = QFileDialog::getOpenFileName(ICore::dialogParent(),
ICore::resourcePath() + QLatin1String("/schemes/"), tr("Import Keyboard Mapping Scheme"),
tr("Keyboard Mapping Scheme (*.kms)")); schemesPath().toString(),
tr("Keyboard Mapping Scheme (*.kms)"));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
CommandsFile cf(fileName); CommandsFile cf(fileName);
@@ -524,10 +530,10 @@ void ShortcutSettingsWidget::defaultAction()
void ShortcutSettingsWidget::exportAction() void ShortcutSettingsWidget::exportAction()
{ {
QString fileName = DocumentManager::getSaveFileNameWithExtension( QString fileName
tr("Export Keyboard Mapping Scheme"), = DocumentManager::getSaveFileNameWithExtension(tr("Export Keyboard Mapping Scheme"),
ICore::resourcePath() + QLatin1String("/schemes/"), schemesPath().toString(),
tr("Keyboard Mapping Scheme (*.kms)")); tr("Keyboard Mapping Scheme (*.kms)"));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
CommandsFile cf(fileName); CommandsFile cf(fileName);
cf.exportCommands(m_scitems); cf.exportCommands(m_scitems);

View File

@@ -90,10 +90,10 @@ ExternalToolManager::ExternalToolManager()
QMap<QString, QMultiMap<int, ExternalTool*> > categoryPriorityMap; QMap<QString, QMultiMap<int, ExternalTool*> > categoryPriorityMap;
QMap<QString, ExternalTool *> tools; QMap<QString, ExternalTool *> tools;
parseDirectory(ICore::userResourcePath() + QLatin1String("/externaltools"), parseDirectory(ICore::userResourcePath().pathAppended("externaltools").toString(),
&categoryPriorityMap, &categoryPriorityMap,
&tools); &tools);
parseDirectory(ICore::resourcePath() + QLatin1String("/externaltools"), parseDirectory(ICore::resourcePath().pathAppended("externaltools").toString(),
&categoryPriorityMap, &categoryPriorityMap,
&tools, &tools,
true); true);

View File

@@ -132,15 +132,16 @@ void GeneralSettingsWidget::fillLanguageBox() const
if (currentLocale == QLatin1String("C")) if (currentLocale == QLatin1String("C"))
m_ui.languageBox->setCurrentIndex(m_ui.languageBox->count() - 1); m_ui.languageBox->setCurrentIndex(m_ui.languageBox->count() - 1);
const QString creatorTrPath = ICore::resourcePath() + QLatin1String("/translations"); const FilePath creatorTrPath = ICore::resourcePath() / "translations";
const QStringList languageFiles = QDir(creatorTrPath).entryList(QStringList(QLatin1String("qtcreator*.qm"))); const QStringList languageFiles = creatorTrPath.toDir().entryList(
QStringList(QLatin1String("qtcreator*.qm")));
for (const QString &languageFile : languageFiles) { for (const QString &languageFile : languageFiles) {
int start = languageFile.indexOf('_') + 1; int start = languageFile.indexOf('_') + 1;
int end = languageFile.lastIndexOf('.'); int end = languageFile.lastIndexOf('.');
const QString locale = languageFile.mid(start, end-start); const QString locale = languageFile.mid(start, end-start);
// no need to show a language that creator will not load anyway // no need to show a language that creator will not load anyway
if (hasQmFilesForLocale(locale, creatorTrPath)) { if (hasQmFilesForLocale(locale, creatorTrPath.toString())) {
QLocale tmpLocale(locale); QLocale tmpLocale(locale);
QString languageItem = QLocale::languageToString(tmpLocale.language()) + QLatin1String(" (") QString languageItem = QLocale::languageToString(tmpLocale.language()) + QLatin1String(" (")
+ QLocale::countryToString(tmpLocale.country()) + QLatin1Char(')'); + QLocale::countryToString(tmpLocale.country()) + QLatin1Char(')');

View File

@@ -396,9 +396,10 @@ QString ICore::userInterfaceLanguage()
\sa userResourcePath() \sa userResourcePath()
*/ */
QString ICore::resourcePath() FilePath ICore::resourcePath()
{ {
return QDir::cleanPath(QCoreApplication::applicationDirPath() + '/' + RELATIVE_DATA_PATH); return FilePath::fromString(
QDir::cleanPath(QCoreApplication::applicationDirPath() + '/' + RELATIVE_DATA_PATH));
} }
/*! /*!
@@ -411,7 +412,7 @@ QString ICore::resourcePath()
\sa resourcePath() \sa resourcePath()
*/ */
QString ICore::userResourcePath() FilePath ICore::userResourcePath()
{ {
// Create qtcreator dir if it doesn't yet exist // Create qtcreator dir if it doesn't yet exist
const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path(); const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path();
@@ -423,24 +424,25 @@ QString ICore::userResourcePath()
qWarning() << "could not create" << urp; qWarning() << "could not create" << urp;
} }
return urp; return FilePath::fromString(urp);
} }
/*! /*!
Returns a writable path that can be used for persistent cache files. Returns a writable path that can be used for persistent cache files.
*/ */
QString ICore::cacheResourcePath() FilePath ICore::cacheResourcePath()
{ {
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation); return FilePath::fromString(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
} }
/*! /*!
Returns the path to resources written by the installer, for example Returns the path to resources written by the installer, for example
pre-defined kits and toolchains. pre-defined kits and toolchains.
*/ */
QString ICore::installerResourcePath() FilePath ICore::installerResourcePath()
{ {
return QFileInfo(settings(QSettings::SystemScope)->fileName()).path() + '/' + Constants::IDE_ID; return FilePath::fromString(settings(QSettings::SystemScope)->fileName()).parentDir()
/ Constants::IDE_ID;
} }
/*! /*!
@@ -476,17 +478,18 @@ QString ICore::userPluginPath()
Returns the path to the command line tools that are included in the \QC Returns the path to the command line tools that are included in the \QC
installation. installation.
*/ */
QString ICore::libexecPath() FilePath ICore::libexecPath()
{ {
return QDir::cleanPath(QApplication::applicationDirPath() + '/' + RELATIVE_LIBEXEC_PATH); return FilePath::fromString(
QDir::cleanPath(QApplication::applicationDirPath() + RELATIVE_LIBEXEC_PATH));
} }
QString ICore::crashReportsPath() FilePath ICore::crashReportsPath()
{ {
if (Utils::HostOsInfo::isMacHost()) if (Utils::HostOsInfo::isMacHost())
return libexecPath() + "/crashpad_reports/completed"; return libexecPath() / "crashpad_reports/completed";
else else
return libexecPath() + "/crashpad_reports/reports"; return libexecPath() / "crashpad_reports/reports";
} }
QString ICore::ideDisplayName() QString ICore::ideDisplayName()
@@ -505,10 +508,10 @@ static QString clangIncludePath(const QString &clangVersion)
QString ICore::clangIncludeDirectory(const QString &clangVersion, QString ICore::clangIncludeDirectory(const QString &clangVersion,
const QString &clangFallbackIncludeDir) const QString &clangFallbackIncludeDir)
{ {
QDir dir(libexecPath() + "/clang" + clangIncludePath(clangVersion)); FilePath dir = libexecPath() / "clang" + clangIncludePath(clangVersion);
if (!dir.exists() || !QFileInfo(dir, "stdint.h").exists()) if (!dir.exists() || !dir.pathAppended("stdint.h").exists())
dir = QDir(clangFallbackIncludeDir); dir = FilePath::fromString(clangFallbackIncludeDir);
return QDir::toNativeSeparators(dir.canonicalPath()); return dir.canonicalPath().toUserOutput();
} }
/*! /*!
@@ -517,10 +520,10 @@ QString ICore::clangIncludeDirectory(const QString &clangVersion,
static QString clangBinary(const QString &binaryBaseName, const QString &clangBinDirectory) static QString clangBinary(const QString &binaryBaseName, const QString &clangBinDirectory)
{ {
const QString hostExeSuffix(QTC_HOST_EXE_SUFFIX); const QString hostExeSuffix(QTC_HOST_EXE_SUFFIX);
QFileInfo executable(ICore::libexecPath() + "/clang/bin/" + binaryBaseName + hostExeSuffix); FilePath executable = ICore::libexecPath() / "clang/bin" / binaryBaseName + hostExeSuffix;
if (!executable.exists()) if (!executable.exists())
executable = QFileInfo(clangBinDirectory + "/" + binaryBaseName + hostExeSuffix); executable = FilePath::fromString(clangBinDirectory) / binaryBaseName + hostExeSuffix;
return QDir::toNativeSeparators(executable.canonicalFilePath()); return executable.canonicalPath().toUserOutput();
} }
/*! /*!

View File

@@ -28,6 +28,7 @@
#include "core_global.h" #include "core_global.h"
#include "icontext.h" #include "icontext.h"
#include <utils/fileutils.h>
#include <utils/qtcsettings.h> #include <utils/qtcsettings.h>
#include <QList> #include <QList>
@@ -94,12 +95,12 @@ public:
static QPrinter *printer(); static QPrinter *printer();
static QString userInterfaceLanguage(); static QString userInterfaceLanguage();
static QString resourcePath(); static Utils::FilePath resourcePath();
static QString userResourcePath(); static Utils::FilePath userResourcePath();
static QString cacheResourcePath(); static Utils::FilePath cacheResourcePath();
static QString installerResourcePath(); static Utils::FilePath installerResourcePath();
static QString libexecPath(); static Utils::FilePath libexecPath();
static QString crashReportsPath(); static Utils::FilePath crashReportsPath();
static QString ideDisplayName(); static QString ideDisplayName();

View File

@@ -502,8 +502,8 @@ void MimeTypeSettingsPrivate::ensurePendingMimeType(const Utils::MimeType &mimeT
void MimeTypeSettingsPrivate::writeUserModifiedMimeTypes() void MimeTypeSettingsPrivate::writeUserModifiedMimeTypes()
{ {
static Utils::FilePath modifiedMimeTypesFile = Utils::FilePath::fromString( static Utils::FilePath modifiedMimeTypesFile = ICore::userResourcePath()
ICore::userResourcePath() + QLatin1String(kModifiedMimeTypesFile)); + kModifiedMimeTypesFile;
if (QFile::exists(modifiedMimeTypesFile.toString()) if (QFile::exists(modifiedMimeTypesFile.toString())
|| QDir().mkpath(modifiedMimeTypesFile.parentDir().toString())) { || QDir().mkpath(modifiedMimeTypesFile.parentDir().toString())) {
@@ -564,10 +564,10 @@ static QPair<int, int> rangeFromString(const QString &offset)
MimeTypeSettingsPrivate::UserMimeTypeHash MimeTypeSettingsPrivate::readUserModifiedMimeTypes() MimeTypeSettingsPrivate::UserMimeTypeHash MimeTypeSettingsPrivate::readUserModifiedMimeTypes()
{ {
static QString modifiedMimeTypesPath = ICore::userResourcePath() static Utils::FilePath modifiedMimeTypesPath = ICore::userResourcePath()
+ QLatin1String(kModifiedMimeTypesFile); + kModifiedMimeTypesFile;
UserMimeTypeHash userMimeTypes; UserMimeTypeHash userMimeTypes;
QFile file(modifiedMimeTypesPath); QFile file(modifiedMimeTypesPath.toString());
if (file.open(QFile::ReadOnly)) { if (file.open(QFile::ReadOnly)) {
UserMimeType mt; UserMimeType mt;
QXmlStreamReader reader(&file); QXmlStreamReader reader(&file);

View File

@@ -211,19 +211,19 @@ QList<ThemeEntry> ThemeEntry::availableThemes()
{ {
QList<ThemeEntry> themes; QList<ThemeEntry> themes;
static const QString installThemeDir = ICore::resourcePath() + QLatin1String("/themes"); static const FilePath installThemeDir = ICore::resourcePath() + QLatin1String("/themes");
static const QString userThemeDir = ICore::userResourcePath() + QLatin1String("/themes"); static const FilePath userThemeDir = ICore::userResourcePath() + QLatin1String("/themes");
addThemesFromPath(installThemeDir, &themes); addThemesFromPath(installThemeDir.toString(), &themes);
if (themes.isEmpty()) if (themes.isEmpty())
qWarning() << "Warning: No themes found in installation: " qWarning() << "Warning: No themes found in installation: "
<< QDir::toNativeSeparators(installThemeDir); << installThemeDir.toUserOutput();
// move default theme to front // move default theme to front
int defaultIndex = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, Id(Constants::DEFAULT_THEME))); int defaultIndex = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, Id(Constants::DEFAULT_THEME)));
if (defaultIndex > 0) { // == exists and not at front if (defaultIndex > 0) { // == exists and not at front
ThemeEntry defaultEntry = themes.takeAt(defaultIndex); ThemeEntry defaultEntry = themes.takeAt(defaultIndex);
themes.prepend(defaultEntry); themes.prepend(defaultEntry);
} }
addThemesFromPath(userThemeDir, &themes); addThemesFromPath(userThemeDir.toString(), &themes);
return themes; return themes;
} }

View File

@@ -303,7 +303,7 @@ void CompilerOptionsBuilder::insertWrappedMingwHeaders()
static QString creatorResourcePath() static QString creatorResourcePath()
{ {
#ifndef UNIT_TESTS #ifndef UNIT_TESTS
return Core::ICore::resourcePath(); return Core::ICore::resourcePath().toString();
#else #else
return QDir::toNativeSeparators(QString::fromUtf8(QTC_RESOURCE_DIR "")); return QDir::toNativeSeparators(QString::fromUtf8(QTC_RESOURCE_DIR ""));
#endif #endif

View File

@@ -2755,7 +2755,7 @@ void CdbEngine::setupScripting(const DebuggerResponse &response)
return; return;
} }
QString dumperPath = QDir::toNativeSeparators(Core::ICore::resourcePath() + "/debugger"); QString dumperPath = Core::ICore::resourcePath().pathAppended("debugger").toUserOutput();
dumperPath.replace('\\', "\\\\"); dumperPath.replace('\\', "\\\\");
runCommand({"sys.path.insert(1, '" + dumperPath + "')", ScriptCommand}); runCommand({"sys.path.insert(1, '" + dumperPath + "')", ScriptCommand});
runCommand({"from cdbbridge import Dumper", ScriptCommand}); runCommand({"from cdbbridge import Dumper", ScriptCommand});

View File

@@ -72,7 +72,7 @@ namespace Internal {
const char DEBUGGER_COUNT_KEY[] = "DebuggerItem.Count"; const char DEBUGGER_COUNT_KEY[] = "DebuggerItem.Count";
const char DEBUGGER_DATA_KEY[] = "DebuggerItem."; const char DEBUGGER_DATA_KEY[] = "DebuggerItem.";
const char DEBUGGER_FILE_VERSION_KEY[] = "Version"; const char DEBUGGER_FILE_VERSION_KEY[] = "Version";
const char DEBUGGER_FILENAME[] = "/debuggers.xml"; const char DEBUGGER_FILENAME[] = "debuggers.xml";
const char debuggingToolsWikiLinkC[] = "http://wiki.qt.io/Qt_Creator_Windows_Debugging"; const char debuggingToolsWikiLinkC[] = "http://wiki.qt.io/Qt_Creator_Windows_Debugging";
class DebuggerItemModel; class DebuggerItemModel;
@@ -835,7 +835,7 @@ void DebuggerItemManagerPrivate::autoDetectUvscDebuggers()
static FilePath userSettingsFileName() static FilePath userSettingsFileName()
{ {
return FilePath::fromString(ICore::userResourcePath() + DEBUGGER_FILENAME); return ICore::userResourcePath() / DEBUGGER_FILENAME;
} }
DebuggerItemManagerPrivate::DebuggerItemManagerPrivate() DebuggerItemManagerPrivate::DebuggerItemManagerPrivate()
@@ -931,7 +931,7 @@ void DebuggerItemManagerPrivate::readDebuggers(const FilePath &fileName, bool is
void DebuggerItemManagerPrivate::restoreDebuggers() void DebuggerItemManagerPrivate::restoreDebuggers()
{ {
// Read debuggers from SDK // Read debuggers from SDK
readDebuggers(FilePath::fromString(ICore::installerResourcePath() + DEBUGGER_FILENAME), true); readDebuggers(ICore::installerResourcePath() / DEBUGGER_FILENAME, true);
// Read all debuggers from user file. // Read all debuggers from user file.
readDebuggers(userSettingsFileName(), false); readDebuggers(userSettingsFileName(), false);

View File

@@ -3970,7 +3970,7 @@ void GdbEngine::setupEngine()
// We need to guarantee a roundtrip before the adapter proceeds. // We need to guarantee a roundtrip before the adapter proceeds.
// Make sure this stays the last command in startGdb(). // Make sure this stays the last command in startGdb().
// Don't use ConsoleCommand, otherwise Mac won't markup the output. // Don't use ConsoleCommand, otherwise Mac won't markup the output.
const QString dumperSourcePath = ICore::resourcePath() + "/debugger/"; const QString dumperSourcePath = ICore::resourcePath().pathAppended("debugger/").toString();
//if (terminal()->isUsable()) //if (terminal()->isUsable())
// runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice())}); // runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice())});

View File

@@ -232,8 +232,8 @@ void LldbEngine::setupEngine()
showStatusMessage(tr("Setting up inferior...")); showStatusMessage(tr("Setting up inferior..."));
const QByteArray dumperSourcePath = const QByteArray dumperSourcePath = ICore::resourcePath().toString().toLocal8Bit()
ICore::resourcePath().toLocal8Bit() + "/debugger/"; + "/debugger/";
executeCommand("script sys.path.insert(1, '" + dumperSourcePath + "')"); executeCommand("script sys.path.insert(1, '" + dumperSourcePath + "')");
// This triggers reportState("enginesetupok") or "enginesetupfailed": // This triggers reportState("enginesetupok") or "enginesetupfailed":

View File

@@ -115,7 +115,7 @@ void PdbEngine::setupEngine()
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
m_interpreter = runParameters().interpreter; m_interpreter = runParameters().interpreter;
QString bridge = ICore::resourcePath() + "/debugger/pdbbridge.py"; QString bridge = ICore::resourcePath().pathAppended("debugger/pdbbridge.py").toString();
connect(&m_proc, &QProcess::errorOccurred, this, &PdbEngine::handlePdbError); connect(&m_proc, &QProcess::errorOccurred, this, &PdbEngine::handlePdbError);
connect(&m_proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), connect(&m_proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),

View File

@@ -106,9 +106,9 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
const QString locale = ICore::userInterfaceLanguage(); const QString locale = ICore::userInterfaceLanguage();
if (!locale.isEmpty()) { if (!locale.isEmpty()) {
auto qtr = new QTranslator(this); auto qtr = new QTranslator(this);
const QString &creatorTrPath = ICore::resourcePath() + "/translations"; const QString creatorTrPath = ICore::resourcePath().pathAppended("translations").toString();
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &trFile = "designer_" + locale; const QString trFile = "designer_" + locale;
if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath)) if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath))
QCoreApplication::installTranslator(qtr); QCoreApplication::installTranslator(qtr);
} }

View File

@@ -84,7 +84,7 @@ void GlslEditorPlugin::InitFile::initialize() const
const int variant = GLSL::Lexer::Variant_All; const int variant = GLSL::Lexer::Variant_All;
QByteArray code; QByteArray code;
QFile file(ICore::resourcePath() + "/glsl/" + m_fileName); QFile file(ICore::resourcePath().pathAppended("glsl").pathAppended(m_fileName).toString());
if (file.open(QFile::ReadOnly)) if (file.open(QFile::ReadOnly))
code = file.readAll(); code = file.readAll();

View File

@@ -125,8 +125,7 @@ HelpManager *HelpManager::instance()
QString HelpManager::collectionFilePath() QString HelpManager::collectionFilePath()
{ {
return QDir::cleanPath(ICore::userResourcePath() return ICore::userResourcePath().pathAppended("helpcollection.qhc").toString();
+ QLatin1String("/helpcollection.qhc"));
} }
void HelpManager::registerDocumentation(const QStringList &files) void HelpManager::registerDocumentation(const QStringList &files)

View File

@@ -189,14 +189,14 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
HelpPluginPrivate::HelpPluginPrivate() HelpPluginPrivate::HelpPluginPrivate()
{ {
const QString &locale = ICore::userInterfaceLanguage(); const QString locale = ICore::userInterfaceLanguage();
if (!locale.isEmpty()) { if (!locale.isEmpty()) {
auto qtr = new QTranslator(this); auto qtr = new QTranslator(this);
auto qhelptr = new QTranslator(this); auto qhelptr = new QTranslator(this);
const QString &creatorTrPath = ICore::resourcePath() + "/translations"; const QString creatorTrPath = ICore::resourcePath().pathAppended("translations").toString();
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &trFile = QLatin1String("assistant_") + locale; const QString trFile = QLatin1String("assistant_") + locale;
const QString &helpTrFile = QLatin1String("qt_help_") + locale; const QString helpTrFile = QLatin1String("qt_help_") + locale;
if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath)) if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath))
QCoreApplication::installTranslator(qtr); QCoreApplication::installTranslator(qtr);
if (qhelptr->load(helpTrFile, qtTrPath) || qhelptr->load(helpTrFile, creatorTrPath)) if (qhelptr->load(helpTrFile, qtTrPath) || qhelptr->load(helpTrFile, creatorTrPath))

View File

@@ -584,8 +584,9 @@ void MacWebKitHelpViewer::setHtml(const QString &html)
{ {
@autoreleasepool { @autoreleasepool {
[m_widget->webView().mainFrame [m_widget->webView().mainFrame
loadHTMLString:html.toNSString() loadHTMLString:html.toNSString()
baseURL:[NSURL fileURLWithPath:Core::ICore::resourcePath().toNSString()]]; baseURL:[NSURL
fileURLWithPath:Core::ICore::resourcePath().toString().toNSString()]];
} }
} }

View File

@@ -1015,8 +1015,7 @@ bool IosSimulatorToolHandlerPrivate::isResponseValid(const SimulatorControl::Res
QString IosToolHandler::iosDeviceToolPath() QString IosToolHandler::iosDeviceToolPath()
{ {
QString res = Core::ICore::libexecPath() + QLatin1String("/ios/iostool"); return Core::ICore::libexecPath().pathAppended("ios/iostool").toString();
return res;
} }
IosToolHandler::IosToolHandler(const Internal::IosDeviceType &devType, QObject *parent) : IosToolHandler::IosToolHandler(const Internal::IosDeviceType &devType, QObject *parent) :

View File

@@ -386,8 +386,7 @@ void MacroManager::saveLastMacro()
QString MacroManager::macrosDirectory() QString MacroManager::macrosDirectory()
{ {
const QString &path = const QString path = Core::ICore::userResourcePath().pathAppended("macros").toString();
Core::ICore::userResourcePath() + QLatin1String("/macros");
if (QFile::exists(path) || QDir().mkpath(path)) if (QFile::exists(path) || QDir().mkpath(path))
return path; return path;
return QString(); return QString();

View File

@@ -762,7 +762,7 @@ static void setKitEnvironment(Kit *k, const McuTarget *mcuTarget,
if (mcuTarget->qulVersion() < QVersionNumber{1,7}) { if (mcuTarget->qulVersion() < QVersionNumber{1,7}) {
const QString path = QLatin1String(HostOsInfo::isWindowsHost() ? "Path" : "PATH"); const QString path = QLatin1String(HostOsInfo::isWindowsHost() ? "Path" : "PATH");
pathAdditions.append("${" + path + "}"); pathAdditions.append("${" + path + "}");
pathAdditions.append(QDir::toNativeSeparators(Core::ICore::libexecPath() + "/clang/bin")); pathAdditions.append(Core::ICore::libexecPath().pathAppended("clang/bin").toUserOutput());
changes.append({path, pathAdditions.join(HostOsInfo::pathListSeparator())}); changes.append({path, pathAdditions.join(HostOsInfo::pathListSeparator())});
} }

View File

@@ -57,8 +57,7 @@ bool withFile(const Utils::FilePath &path, const F &f)
Utils::FilePath MachineFilesDir() Utils::FilePath MachineFilesDir()
{ {
return Utils::FilePath::fromString(Core::ICore::userResourcePath()) return Core::ICore::userResourcePath() / "Meson-machine-files";
.pathAppended("Meson-machine-files");
} }
MachineFileManager::MachineFileManager() MachineFileManager::MachineFileManager()

View File

@@ -54,8 +54,7 @@ ToolsSettingsAccessor::ToolsSettingsAccessor()
"Meson"), "Meson"),
Core::Constants::IDE_DISPLAY_NAME) Core::Constants::IDE_DISPLAY_NAME)
{ {
setBaseFilePath(Utils::FilePath::fromString(Core::ICore::userResourcePath()) setBaseFilePath(Core::ICore::userResourcePath() / Constants::ToolsSettings::FILENAME);
.pathAppended(Constants::ToolsSettings::FILENAME));
} }
void ToolsSettingsAccessor::saveMesonTools(const std::vector<MesonTools::Tool_t> &tools, void ToolsSettingsAccessor::saveMesonTools(const std::vector<MesonTools::Tool_t> &tools,

View File

@@ -140,10 +140,9 @@ ModelsManager::~ModelsManager()
ExtDocumentController *ModelsManager::createModel(ModelDocument *modelDocument) ExtDocumentController *ModelsManager::createModel(ModelDocument *modelDocument)
{ {
auto documentController = new ExtDocumentController(this); auto documentController = new ExtDocumentController(this);
QDir dir;
dir.setPath(Core::ICore::resourcePath() + QLatin1String("/modeleditor"));
// TODO error output on reading definition files // TODO error output on reading definition files
documentController->configController()->readStereotypeDefinitions(dir.path()); documentController->configController()->readStereotypeDefinitions(
Core::ICore::resourcePath().pathAppended("modeleditor").toString());
d->managedModels.append(ManagedModel(documentController, modelDocument)); d->managedModels.append(ManagedModel(documentController, modelDocument));
return documentController; return documentController;

View File

@@ -406,8 +406,8 @@ QString PerfDataReader::findPerfParser()
{ {
QString filePath = QString::fromLocal8Bit(qgetenv("PERFPROFILER_PARSER_FILEPATH")); QString filePath = QString::fromLocal8Bit(qgetenv("PERFPROFILER_PARSER_FILEPATH"));
if (filePath.isEmpty()) { if (filePath.isEmpty()) {
filePath = QString::fromLatin1("%1/perfparser%2").arg(Core::ICore::libexecPath(), filePath = QString::fromLatin1("%1/perfparser%2")
QString(QTC_HOST_EXE_SUFFIX)); .arg(Core::ICore::libexecPath().toString(), QString(QTC_HOST_EXE_SUFFIX));
} }
return QDir::toNativeSeparators(QDir::cleanPath(filePath)); return QDir::toNativeSeparators(QDir::cleanPath(filePath));
} }

View File

@@ -383,13 +383,11 @@ QList<Core::IWizardFactory *> CustomWizard::createWizards()
{ {
QString errorMessage; QString errorMessage;
QString verboseLog; QString verboseLog;
const QString templateDirName = Core::ICore::resourcePath() + const QString templateDirName
QLatin1Char('/') + QLatin1String(templatePathC); = Core::ICore::resourcePath().pathAppended(templatePathC).toString();
const QString userTemplateDirName = Core::ICore::userResourcePath() +
QLatin1Char('/') + QLatin1String(templatePathC);
const QString userTemplateDirName
= Core::ICore::userResourcePath().pathAppended(templatePathC).toString();
const QDir templateDir(templateDirName); const QDir templateDir(templateDirName);
if (CustomWizardPrivate::verbose) if (CustomWizardPrivate::verbose)

View File

@@ -225,13 +225,12 @@ QVariantMap DeviceManager::toMap() const
Utils::FilePath DeviceManager::settingsFilePath(const QString &extension) Utils::FilePath DeviceManager::settingsFilePath(const QString &extension)
{ {
return Utils::FilePath::fromString(Core::ICore::userResourcePath() + extension); return Core::ICore::userResourcePath() + extension;
} }
Utils::FilePath DeviceManager::systemSettingsFilePath(const QString &deviceFileRelativePath) Utils::FilePath DeviceManager::systemSettingsFilePath(const QString &deviceFileRelativePath)
{ {
return Utils::FilePath::fromString(Core::ICore::installerResourcePath() return Core::ICore::installerResourcePath() + deviceFileRelativePath;
+ deviceFileRelativePath);
} }
void DeviceManager::addDevice(const IDevice::ConstPtr &_device) void DeviceManager::addDevice(const IDevice::ConstPtr &_device)

View File

@@ -65,7 +65,7 @@ AbiFlavorAccessor::AbiFlavorAccessor() :
QCoreApplication::translate("ProjectExplorer::ToolChainManager", "ABI"), QCoreApplication::translate("ProjectExplorer::ToolChainManager", "ABI"),
Core::Constants::IDE_DISPLAY_NAME) Core::Constants::IDE_DISPLAY_NAME)
{ {
setBaseFilePath(FilePath::fromString(Core::ICore::installerResourcePath() + "/abi.xml")); setBaseFilePath(Core::ICore::installerResourcePath() / "abi.xml");
addVersionUpgrader(std::make_unique<AbiFlavorUpgraderV0>()); addVersionUpgrader(std::make_unique<AbiFlavorUpgraderV0>());
} }

View File

@@ -257,7 +257,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testJsonWizardsComboBox()
static QString iconInsideResource(const QString &relativePathToIcon) static QString iconInsideResource(const QString &relativePathToIcon)
{ {
const QDir resourcePath(Core::ICore::resourcePath()); const QDir resourcePath(Core::ICore::resourcePath().toDir());
return resourcePath.filePath(relativePathToIcon); return resourcePath.filePath(relativePathToIcon);
} }

View File

@@ -336,11 +336,8 @@ static QStringList environmentTemplatesPaths()
Utils::FilePaths &JsonWizardFactory::searchPaths() Utils::FilePaths &JsonWizardFactory::searchPaths()
{ {
static Utils::FilePaths m_searchPaths = Utils::FilePaths() static Utils::FilePaths m_searchPaths = {Core::ICore::userResourcePath() / WIZARD_PATH,
<< Utils::FilePath::fromString(Core::ICore::userResourcePath() + QLatin1Char('/') + Core::ICore::resourcePath() / WIZARD_PATH};
QLatin1String(WIZARD_PATH))
<< Utils::FilePath::fromString(Core::ICore::resourcePath() + QLatin1Char('/') +
QLatin1String(WIZARD_PATH));
for (const QString &environmentTemplateDirName : environmentTemplatesPaths()) for (const QString &environmentTemplateDirName : environmentTemplatesPaths())
m_searchPaths << Utils::FilePath::fromString(environmentTemplateDirName); m_searchPaths << Utils::FilePath::fromString(environmentTemplateDirName);

View File

@@ -79,11 +79,11 @@ const char KIT_COUNT_KEY[] = "Profile.Count";
const char KIT_FILE_VERSION_KEY[] = "Version"; const char KIT_FILE_VERSION_KEY[] = "Version";
const char KIT_DEFAULT_KEY[] = "Profile.Default"; const char KIT_DEFAULT_KEY[] = "Profile.Default";
const char KIT_IRRELEVANT_ASPECTS_KEY[] = "Kit.IrrelevantAspects"; const char KIT_IRRELEVANT_ASPECTS_KEY[] = "Kit.IrrelevantAspects";
const char KIT_FILENAME[] = "/profiles.xml"; const char KIT_FILENAME[] = "profiles.xml";
static FilePath settingsFileName() static FilePath settingsFileName()
{ {
return FilePath::fromString(ICore::userResourcePath() + KIT_FILENAME); return ICore::userResourcePath() / KIT_FILENAME;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -197,8 +197,7 @@ void KitManager::restoreKits()
// read all kits from SDK // read all kits from SDK
{ {
KitList system = restoreKitsHelper KitList system = restoreKitsHelper(ICore::installerResourcePath() / KIT_FILENAME);
(FilePath::fromString(ICore::installerResourcePath() + KIT_FILENAME));
// SDK kits need to get updated with the user-provided extra settings: // SDK kits need to get updated with the user-provided extra settings:
for (auto &current : system.kits) { for (auto &current : system.kits) {

View File

@@ -2049,8 +2049,7 @@ void ProjectExplorerPlugin::extensionsInitialized()
QSsh::SshSettings::loadSettings(Core::ICore::settings()); QSsh::SshSettings::loadSettings(Core::ICore::settings());
const auto searchPathRetriever = [] { const auto searchPathRetriever = [] {
Utils::FilePaths searchPaths; Utils::FilePaths searchPaths = {Core::ICore::libexecPath()};
searchPaths << Utils::FilePath::fromString(Core::ICore::libexecPath());
if (Utils::HostOsInfo::isWindowsHost()) { if (Utils::HostOsInfo::isWindowsHost()) {
const QString gitBinary = Core::ICore::settings()->value("Git/BinaryPath", "git") const QString gitBinary = Core::ICore::settings()->value("Git/BinaryPath", "git")
.toString(); .toString();

View File

@@ -768,7 +768,7 @@ QStringList SessionManager::sessions()
{ {
if (d->m_sessions.isEmpty()) { if (d->m_sessions.isEmpty()) {
// We are not initialized yet, so do that now // We are not initialized yet, so do that now
QDir sessionDir(ICore::userResourcePath()); QDir sessionDir(ICore::userResourcePath().toDir());
QFileInfoList sessionFiles = sessionDir.entryInfoList(QStringList() << QLatin1String("*.qws"), QDir::NoFilter, QDir::Time); QFileInfoList sessionFiles = sessionDir.entryInfoList(QStringList() << QLatin1String("*.qws"), QDir::NoFilter, QDir::Time);
foreach (const QFileInfo &fileInfo, sessionFiles) { foreach (const QFileInfo &fileInfo, sessionFiles) {
const QString &name = fileInfo.completeBaseName(); const QString &name = fileInfo.completeBaseName();
@@ -788,7 +788,7 @@ QDateTime SessionManager::sessionDateTime(const QString &session)
FilePath SessionManager::sessionNameToFileName(const QString &session) FilePath SessionManager::sessionNameToFileName(const QString &session)
{ {
return FilePath::fromString(ICore::userResourcePath() + QLatin1Char('/') + session + QLatin1String(".qws")); return ICore::userResourcePath() / session + ".qws";
} }
/*! /*!

View File

@@ -58,7 +58,7 @@ public:
static const char TOOLCHAIN_DATA_KEY[] = "ToolChain."; static const char TOOLCHAIN_DATA_KEY[] = "ToolChain.";
static const char TOOLCHAIN_COUNT_KEY[] = "ToolChain.Count"; static const char TOOLCHAIN_COUNT_KEY[] = "ToolChain.Count";
static const char TOOLCHAIN_FILENAME[] = "/toolchains.xml"; static const char TOOLCHAIN_FILENAME[] = "toolchains.xml";
struct ToolChainOperations struct ToolChainOperations
{ {
@@ -184,7 +184,7 @@ ToolChainSettingsAccessor::ToolChainSettingsAccessor() :
QCoreApplication::translate("ProjectExplorer::ToolChainManager", "Tool Chains"), QCoreApplication::translate("ProjectExplorer::ToolChainManager", "Tool Chains"),
Core::Constants::IDE_DISPLAY_NAME) Core::Constants::IDE_DISPLAY_NAME)
{ {
setBaseFilePath(FilePath::fromString(Core::ICore::userResourcePath() + TOOLCHAIN_FILENAME)); setBaseFilePath(Core::ICore::userResourcePath() / TOOLCHAIN_FILENAME);
addVersionUpgrader(std::make_unique<ToolChainSettingsUpgraderV0>()); addVersionUpgrader(std::make_unique<ToolChainSettingsUpgraderV0>());
} }
@@ -192,9 +192,8 @@ ToolChainSettingsAccessor::ToolChainSettingsAccessor() :
QList<ToolChain *> ToolChainSettingsAccessor::restoreToolChains(QWidget *parent) const QList<ToolChain *> ToolChainSettingsAccessor::restoreToolChains(QWidget *parent) const
{ {
// read all tool chains from SDK // read all tool chains from SDK
const QList<ToolChain *> systemFileTcs const QList<ToolChain *> systemFileTcs = toolChains(
= toolChains(restoreSettings(FilePath::fromString(Core::ICore::installerResourcePath() + TOOLCHAIN_FILENAME), restoreSettings(Core::ICore::installerResourcePath() / TOOLCHAIN_FILENAME, parent));
parent));
for (ToolChain * const systemTc : systemFileTcs) for (ToolChain * const systemTc : systemFileTcs)
systemTc->setDetection(ToolChain::AutoDetectionFromSdk); systemTc->setDetection(ToolChain::AutoDetectionFromSdk);

View File

@@ -85,7 +85,7 @@ bool QbsSettings::useCreatorSettingsDirForQbs()
QString QbsSettings::qbsSettingsBaseDir() QString QbsSettings::qbsSettingsBaseDir()
{ {
return useCreatorSettingsDirForQbs() ? Core::ICore::userResourcePath() : QString(); return useCreatorSettingsDirForQbs() ? Core::ICore::userResourcePath().toString() : QString();
} }
QbsSettings &QbsSettings::instance() QbsSettings &QbsSettings::instance()

View File

@@ -102,9 +102,7 @@ bool QtWizard::qt4ProjectPostGenerateFiles(const QWizard *w,
QString QtWizard::templateDir() QString QtWizard::templateDir()
{ {
QString rc = Core::ICore::resourcePath(); return Core::ICore::resourcePath().pathAppended("templates/qt4project").toString();
rc += QLatin1String("/templates/qt4project");
return rc;
} }
bool QtWizard::lowerCaseFiles() bool QtWizard::lowerCaseFiles()

View File

@@ -44,7 +44,9 @@ QmlDesignerIconProvider::QmlDesignerIconProvider()
static QString iconPath() static QString iconPath()
{ {
return Core::ICore::resourcePath() + QLatin1String("/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/images/"); return Core::ICore::resourcePath()
.pathAppended("qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/images/")
.toString();
} }
QPixmap QmlDesignerIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) QPixmap QmlDesignerIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)

View File

@@ -49,8 +49,11 @@ Theme::Theme(Utils::Theme *originTheme, QObject *parent)
: Utils::Theme(originTheme, parent) : Utils::Theme(originTheme, parent)
, m_constants(nullptr) , m_constants(nullptr)
{ {
QString constantsPath = Core::ICore::resourcePath() + QString constantsPath
QStringLiteral("/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml"); = Core::ICore::resourcePath()
.pathAppended(
"qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml")
.toString();
QQmlEngine* engine = new QQmlEngine(this); QQmlEngine* engine = new QQmlEngine(this);
QQmlComponent component(engine, QUrl::fromLocalFile(constantsPath)); QQmlComponent component(engine, QUrl::fromLocalFile(constantsPath));

View File

@@ -65,8 +65,8 @@ ProjectExplorer::Target *activeTarget(ProjectExplorer::Project *project)
class ImageCacheData class ImageCacheData
{ {
public: public:
Sqlite::Database database{ Sqlite::Database database{Utils::PathString{
Utils::PathString{Core::ICore::cacheResourcePath() + "/imagecache-v2.db"}}; Core::ICore::cacheResourcePath().pathAppended("imagecache-v2.db").toString()}};
ImageCacheStorage<Sqlite::Database> storage{database}; ImageCacheStorage<Sqlite::Database> storage{database};
ImageCacheConnectionManager connectionManager; ImageCacheConnectionManager connectionManager;
ImageCacheCollector collector{connectionManager}; ImageCacheCollector collector{connectionManager};

View File

@@ -76,7 +76,9 @@
namespace QmlDesigner { namespace QmlDesigner {
static QString propertyEditorResourcesPath() { static QString propertyEditorResourcesPath() {
return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/propertyEditorQmlSources"); return Core::ICore::resourcePath()
.pathAppended("qmldesigner/propertyEditorQmlSources")
.toString();
} }
bool ItemLibraryWidget::eventFilter(QObject *obj, QEvent *event) bool ItemLibraryWidget::eventFilter(QObject *obj, QEvent *event)
@@ -324,7 +326,7 @@ void ItemLibraryWidget::handleTabChanged(int index)
QString ItemLibraryWidget::qmlSourcesPath() QString ItemLibraryWidget::qmlSourcesPath()
{ {
return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/itemLibraryQmlSources"); return Core::ICore::resourcePath().pathAppended("qmldesigner/itemLibraryQmlSources").toString();
} }
void ItemLibraryWidget::clearSearchFilter() void ItemLibraryWidget::clearSearchFilter()

View File

@@ -39,14 +39,14 @@
namespace Internal { namespace Internal {
static const char settingsKey[] = "GradientPresetCustomList"; static const char settingsKey[] = "GradientPresetCustomList";
static const char settingsFileName[] = "/GradientPresets.ini"; static const char settingsFileName[] = "GradientPresets.ini";
QString settingsFullFilePath(const QSettings::Scope &scope) QString settingsFullFilePath(const QSettings::Scope &scope)
{ {
if (scope == QSettings::SystemScope) if (scope == QSettings::SystemScope)
return Core::ICore::installerResourcePath() + settingsFileName; return Core::ICore::installerResourcePath().pathAppended(settingsFileName).toString();
return Core::ICore::userResourcePath() + settingsFileName; return Core::ICore::userResourcePath().pathAppended(settingsFileName).toString();
} }
} // namespace Internal } // namespace Internal

View File

@@ -531,7 +531,9 @@ void PropertyEditorQmlBackend::initialSetup(const TypeName &typeName, const QUrl
} }
QString PropertyEditorQmlBackend::propertyEditorResourcesPath() { QString PropertyEditorQmlBackend::propertyEditorResourcesPath() {
return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/propertyEditorQmlSources"); return Core::ICore::resourcePath()
.pathAppended("qmldesigner/propertyEditorQmlSources")
.toString();
} }
inline bool dotPropertyHeuristic(const QmlObjectNode &node, const NodeMetaInfo &type, const PropertyName &name) inline bool dotPropertyHeuristic(const QmlObjectNode &node, const NodeMetaInfo &type, const PropertyName &name)

View File

@@ -57,7 +57,9 @@ enum {
namespace QmlDesigner { namespace QmlDesigner {
static QString propertyEditorResourcesPath() { static QString propertyEditorResourcesPath() {
return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/propertyEditorQmlSources"); return Core::ICore::resourcePath()
.pathAppended("qmldesigner/propertyEditorQmlSources")
.toString();
} }
int StatesEditorWidget::currentStateInternalId() const int StatesEditorWidget::currentStateInternalId() const
@@ -120,7 +122,7 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, State
StatesEditorWidget::~StatesEditorWidget() = default; StatesEditorWidget::~StatesEditorWidget() = default;
QString StatesEditorWidget::qmlSourcesPath() { QString StatesEditorWidget::qmlSourcesPath() {
return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/statesEditorQmlSources"); return Core::ICore::resourcePath().pathAppended("qmldesigner/statesEditorQmlSources").toString();
} }
void StatesEditorWidget::toggleStatesViewExpanded() void StatesEditorWidget::toggleStatesViewExpanded()

View File

@@ -141,14 +141,14 @@ QIcon paintPreview(const EasingCurve &curve, const QColor& background, const QCo
namespace Internal { namespace Internal {
static const char settingsKey[] = "EasingCurveList"; static const char settingsKey[] = "EasingCurveList";
static const char settingsFileName[] = "/EasingCurves.ini"; static const char settingsFileName[] = "EasingCurves.ini";
QString settingsFullFilePath(const QSettings::Scope &scope) QString settingsFullFilePath(const QSettings::Scope &scope)
{ {
if (scope == QSettings::SystemScope) if (scope == QSettings::SystemScope)
return Core::ICore::installerResourcePath() + settingsFileName; return Core::ICore::installerResourcePath().pathAppended(settingsFileName).toString();
return Core::ICore::userResourcePath() + settingsFileName; return Core::ICore::userResourcePath().pathAppended(settingsFileName).toString();
} }
} // namespace Internal } // namespace Internal

View File

@@ -392,7 +392,7 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing()
QString PuppetCreator::defaultPuppetToplevelBuildDirectory() QString PuppetCreator::defaultPuppetToplevelBuildDirectory()
{ {
return Core::ICore::userResourcePath() + "/qmlpuppet/"; return Core::ICore::userResourcePath().pathAppended("qmlpuppet/").toString();
} }
QString PuppetCreator::qmlPuppetToplevelBuildDirectory() const QString PuppetCreator::qmlPuppetToplevelBuildDirectory() const
@@ -424,9 +424,9 @@ QString PuppetCreator::qmlPuppetDirectory(PuppetType puppetType) const
QString PuppetCreator::defaultPuppetFallbackDirectory() QString PuppetCreator::defaultPuppetFallbackDirectory()
{ {
if (Utils::HostOsInfo::isMacHost()) if (Utils::HostOsInfo::isMacHost())
return Core::ICore::libexecPath() + "/qmldesigner"; return Core::ICore::libexecPath().pathAppended("qmldesigner").toString();
else else
return Core::ICore::libexecPath(); return Core::ICore::libexecPath().toString();
} }
QString PuppetCreator::qmlPuppetFallbackDirectory(const DesignerSettings &settings) QString PuppetCreator::qmlPuppetFallbackDirectory(const DesignerSettings &settings)
@@ -639,7 +639,7 @@ bool PuppetCreator::startBuildProcess(const QString &buildDirectoryPath,
QString PuppetCreator::puppetSourceDirectoryPath() QString PuppetCreator::puppetSourceDirectoryPath()
{ {
return Core::ICore::resourcePath() + "/qml/qmlpuppet"; return Core::ICore::resourcePath().pathAppended("qml/qmlpuppet").toString();
} }
QString PuppetCreator::qml2PuppetProjectFile() QString PuppetCreator::qml2PuppetProjectFile()

View File

@@ -64,7 +64,7 @@ DesignerMcuManager &DesignerMcuManager::instance()
QString DesignerMcuManager::mcuResourcesPath() QString DesignerMcuManager::mcuResourcesPath()
{ {
return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/qt4mcu"); return Core::ICore::resourcePath().pathAppended("qmldesigner/qt4mcu").toString();
} }
bool DesignerMcuManager::isMCUProject() const bool DesignerMcuManager::isMCUProject() const

View File

@@ -234,7 +234,8 @@ void DesignModeWidget::setup()
ADS::DockManager::setConfigFlag(ADS::DockManager::AllTabsHaveCloseButton, true); ADS::DockManager::setConfigFlag(ADS::DockManager::AllTabsHaveCloseButton, true);
m_dockManager = new ADS::DockManager(this); m_dockManager = new ADS::DockManager(this);
m_dockManager->setSettings(settings); m_dockManager->setSettings(settings);
m_dockManager->setWorkspacePresetsPath(Core::ICore::resourcePath() + QLatin1String("/qmldesigner/workspacePresets/")); m_dockManager->setWorkspacePresetsPath(
Core::ICore::resourcePath().pathAppended("qmldesigner/workspacePresets/").toString());
QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/dockwidgets.css")); QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/dockwidgets.css"));
m_dockManager->setStyleSheet(Theme::replaceCssColors(sheet)); m_dockManager->setStyleSheet(Theme::replaceCssColors(sheet));

View File

@@ -211,7 +211,7 @@ QmlDesignerPlugin::~QmlDesignerPlugin()
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage/* = 0*/) bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage/* = 0*/)
{ {
QDir{}.mkpath(Core::ICore::cacheResourcePath()); QDir{}.mkpath(Core::ICore::cacheResourcePath().toString());
if (!Utils::HostOsInfo::canCreateOpenGLContext(errorMessage)) if (!Utils::HostOsInfo::canCreateOpenGLContext(errorMessage))
return false; return false;
@@ -219,8 +219,10 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e
if (DesignerSettings::getValue(DesignerSettingsKey::STANDALONE_MODE).toBool()) if (DesignerSettings::getValue(DesignerSettingsKey::STANDALONE_MODE).toBool())
GenerateResource::generateMenuEntry(); GenerateResource::generateMenuEntry();
QString fontPath = Core::ICore::resourcePath() + const QString fontPath
QStringLiteral("/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf"); = Core::ICore::resourcePath()
.pathAppended("qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf")
.toString();
if (QFontDatabase::addApplicationFont(fontPath) < 0) if (QFontDatabase::addApplicationFont(fontPath) < 0)
qCWarning(qmldesignerLog) << "Could not add font " << fontPath << "to font database"; qCWarning(qmldesignerLog) << "Could not add font " << fontPath << "to font database";

View File

@@ -92,8 +92,9 @@ public:
QPointer<QmlJSEditorDocument> m_currentDocument; QPointer<QmlJSEditorDocument> m_currentDocument;
Utils::JsonSchemaManager m_jsonManager{{ICore::userResourcePath() + "/json/", Utils::JsonSchemaManager m_jsonManager{
ICore::resourcePath() + "/json/"}}; {ICore::userResourcePath().pathAppended("json/").toString(),
ICore::resourcePath().pathAppended("json/").toString()}};
QmlJSEditorFactory m_qmlJSEditorFactory; QmlJSEditorFactory m_qmlJSEditorFactory;
QmlJSOutlineWidgetFactory m_qmlJSOutlineWidgetFactory; QmlJSOutlineWidgetFactory m_qmlJSOutlineWidgetFactory;
QuickToolBar m_quickToolBar; QuickToolBar m_quickToolBar;

View File

@@ -328,8 +328,8 @@ QmlOutlineModel::QmlOutlineModel(QmlJSEditorDocument *document) :
m_editorDocument(document) m_editorDocument(document)
{ {
m_icons = Icons::instance(); m_icons = Icons::instance();
const QString resourcePath = Core::ICore::resourcePath(); Icons::instance()->setIconFilesPath(
Icons::instance()->setIconFilesPath(resourcePath + QLatin1String("/qmlicons")); Core::ICore::resourcePath().pathAppended("qmlicons").toString());
setItemPrototype(new QmlOutlineItem(this)); setItemPrototype(new QmlOutlineItem(this));
} }

View File

@@ -51,16 +51,15 @@ QmlBundle BasicBundleProvider::defaultBundle(const QString &bundleInfoName)
{ {
static bool wroteErrors = false; static bool wroteErrors = false;
QmlBundle res; QmlBundle res;
QString defaultBundlePath = Core::ICore::resourcePath() const Utils::FilePath defaultBundlePath = Core::ICore::resourcePath() / "qml-type-descriptions"
+ QLatin1String("/qml-type-descriptions/") / bundleInfoName;
+ bundleInfoName; if (!defaultBundlePath.exists()) {
if (!QFileInfo::exists(defaultBundlePath)) {
qWarning() << "BasicBundleProvider: ERROR " << defaultBundlePath qWarning() << "BasicBundleProvider: ERROR " << defaultBundlePath
<< " not found"; << " not found";
return res; return res;
} }
QStringList errors; QStringList errors;
if (!res.readFrom(defaultBundlePath, &errors) && ! wroteErrors) { if (!res.readFrom(defaultBundlePath.toString(), &errors) && !wroteErrors) {
qWarning() << "BasicBundleProvider: ERROR reading " << defaultBundlePath qWarning() << "BasicBundleProvider: ERROR reading " << defaultBundlePath
<< " : " << errors; << " : " << errors;
wroteErrors = true; wroteErrors = true;

View File

@@ -220,15 +220,15 @@ void ModelManager::delayedInitialization()
ViewerContext qbsVContext; ViewerContext qbsVContext;
qbsVContext.language = Dialect::QmlQbs; qbsVContext.language = Dialect::QmlQbs;
qbsVContext.paths.append(ICore::resourcePath() + QLatin1String("/qbs")); qbsVContext.paths.append(ICore::resourcePath().pathAppended("qbs").toString());
setDefaultVContext(qbsVContext); setDefaultVContext(qbsVContext);
} }
void ModelManager::loadDefaultQmlTypeDescriptions() void ModelManager::loadDefaultQmlTypeDescriptions()
{ {
if (ICore::instance()) { if (ICore::instance()) {
loadQmlTypeDescriptionsInternal(ICore::resourcePath()); loadQmlTypeDescriptionsInternal(ICore::resourcePath().toString());
loadQmlTypeDescriptionsInternal(ICore::userResourcePath()); loadQmlTypeDescriptionsInternal(ICore::userResourcePath().toString());
} }
} }

View File

@@ -43,7 +43,10 @@ void QmlJSToolsPlugin::test_basic()
{ {
ModelManagerInterface *modelManager = ModelManagerInterface::instance(); ModelManagerInterface *modelManager = ModelManagerInterface::instance();
const QString qmlFilePath = Core::ICore::resourcePath() + QLatin1String("/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml"); const QString qmlFilePath = Core::ICore::resourcePath()
.pathAppended(
"qmldesigner/itemLibraryQmlSources/ItemDelegate.qml")
.toString();
modelManager->updateSourceFiles(QStringList(qmlFilePath), false); modelManager->updateSourceFiles(QStringList(qmlFilePath), false);
modelManager->test_joinAllThreads(); modelManager->test_joinAllThreads();

View File

@@ -40,7 +40,7 @@ const QLatin1String QNXConfigsFileVersionKey("Version");
static FilePath qnxConfigSettingsFileName() static FilePath qnxConfigSettingsFileName()
{ {
return FilePath::fromString(Core::ICore::userResourcePath() + "/qnx/qnxconfigurations.xml"); return Core::ICore::userResourcePath() / "qnx/qnxconfigurations.xml";
} }
static QnxConfigurationManager *m_instance = nullptr; static QnxConfigurationManager *m_instance = nullptr;

View File

@@ -449,7 +449,7 @@ void ExamplesListModel::parseTutorials(QXmlStreamReader *reader, const QString &
static QString resourcePath() static QString resourcePath()
{ {
// normalize paths so QML doesn't freak out if it's wrongly capitalized on Windows // normalize paths so QML doesn't freak out if it's wrongly capitalized on Windows
return Utils::FileUtils::normalizePathName(Core::ICore::resourcePath()); return Utils::FileUtils::normalizePathName(Core::ICore::resourcePath().toString());
} }
void ExamplesListModel::updateExamples() void ExamplesListModel::updateExamples()

View File

@@ -805,7 +805,7 @@ static QString qtVersionsFile(const QString &baseDir)
static Utils::optional<QString> currentlyLinkedQtDir(bool *hasInstallSettings) static Utils::optional<QString> currentlyLinkedQtDir(bool *hasInstallSettings)
{ {
const QString installSettingsFilePath = settingsFile(Core::ICore::resourcePath()); const QString installSettingsFilePath = settingsFile(Core::ICore::resourcePath().toString());
const bool installSettingsExist = QFile::exists(installSettingsFilePath); const bool installSettingsExist = QFile::exists(installSettingsFilePath);
if (hasInstallSettings) if (hasInstallSettings)
*hasInstallSettings = installSettingsExist; *hasInstallSettings = installSettingsExist;
@@ -834,7 +834,7 @@ static bool canLinkWithQt(QString *toolTip)
&installSettingsExist); &installSettingsExist);
QStringList tip; QStringList tip;
tip << linkingPurposeText(); tip << linkingPurposeText();
if (!FilePath::fromString(Core::ICore::resourcePath()).isWritablePath()) { if (!Core::ICore::resourcePath().isWritablePath()) {
canLink = false; canLink = false;
tip << QtOptionsPageWidget::tr("%1's resource directory is not writable.") tip << QtOptionsPageWidget::tr("%1's resource directory is not writable.")
.arg(Core::Constants::IDE_DISPLAY_NAME); .arg(Core::Constants::IDE_DISPLAY_NAME);
@@ -997,7 +997,7 @@ void QtOptionsPageWidget::linkWithQt()
unlinkButton->setEnabled(currentLink.has_value()); unlinkButton->setEnabled(currentLink.has_value());
connect(unlinkButton, &QPushButton::clicked, &dialog, [&dialog, &askForRestart] { connect(unlinkButton, &QPushButton::clicked, &dialog, [&dialog, &askForRestart] {
bool removeSettingsFile = false; bool removeSettingsFile = false;
const QString filePath = settingsFile(Core::ICore::resourcePath()); const QString filePath = settingsFile(Core::ICore::resourcePath().toString());
{ {
QSettings installSettings(filePath, QSettings::IniFormat); QSettings installSettings(filePath, QSettings::IniFormat);
installSettings.remove(kInstallSettingsKey); installSettings.remove(kInstallSettingsKey);
@@ -1016,7 +1016,7 @@ void QtOptionsPageWidget::linkWithQt()
if (dialog.result() == QDialog::Accepted) { if (dialog.result() == QDialog::Accepted) {
const Utils::optional<QString> settingsDir = settingsDirForQtDir(pathInput->rawPath()); const Utils::optional<QString> settingsDir = settingsDirForQtDir(pathInput->rawPath());
if (QTC_GUARD(settingsDir)) { if (QTC_GUARD(settingsDir)) {
QSettings(settingsFile(Core::ICore::resourcePath()), QSettings::IniFormat) QSettings(settingsFile(Core::ICore::resourcePath().toString()), QSettings::IniFormat)
.setValue(kInstallSettingsKey, *settingsDir); .setValue(kInstallSettingsKey, *settingsDir);
askForRestart = true; askForRestart = true;
} }

View File

@@ -65,7 +65,7 @@ using namespace Internal;
const char QTVERSION_DATA_KEY[] = "QtVersion."; const char QTVERSION_DATA_KEY[] = "QtVersion.";
const char QTVERSION_TYPE_KEY[] = "QtVersion.Type"; const char QTVERSION_TYPE_KEY[] = "QtVersion.Type";
const char QTVERSION_FILE_VERSION_KEY[] = "Version"; const char QTVERSION_FILE_VERSION_KEY[] = "Version";
const char QTVERSION_FILENAME[] = "/qtversion.xml"; const char QTVERSION_FILENAME[] = "qtversion.xml";
using VersionMap = QMap<int, BaseQtVersion *>; using VersionMap = QMap<int, BaseQtVersion *>;
static VersionMap m_versions; static VersionMap m_versions;
@@ -84,12 +84,12 @@ static Q_LOGGING_CATEGORY(log, "qtc.qt.versions", QtWarningMsg);
static FilePath globalSettingsFileName() static FilePath globalSettingsFileName()
{ {
return FilePath::fromString(Core::ICore::installerResourcePath() + QTVERSION_FILENAME); return Core::ICore::installerResourcePath() / QTVERSION_FILENAME;
} }
static FilePath settingsFileName(const QString &path) static FilePath settingsFileName(const QString &path)
{ {
return FilePath::fromString(Core::ICore::userResourcePath() + path); return Core::ICore::userResourcePath() / path;
} }

View File

@@ -65,8 +65,10 @@ void ExampleCheckout::checkoutExample(const QUrl &url)
layout->addWidget(widget); layout->addWidget(widget);
widget->engine()->addImportPath("qrc:/studiofonts"); widget->engine()->addImportPath("qrc:/studiofonts");
widget->engine()->addImportPath(Core::ICore::resourcePath() widget->engine()->addImportPath(
+ "/qmldesigner/propertyEditorQmlSources/imports"); Core::ICore::resourcePath()
.pathAppended("/qmldesigner/propertyEditorQmlSources/imports")
.toString());
widget->setSource(QUrl("qrc:/qml/downloaddialog/main.qml")); widget->setSource(QUrl("qrc:/qml/downloaddialog/main.qml"));

View File

@@ -207,14 +207,14 @@ public:
return; return;
} }
const QString projectFile = Core::ICore::resourcePath() + "/examples/" + example + "/" const Utils::FilePath projectFile = Core::ICore::resourcePath() / "examples" / example
+ example + ".qmlproject"; / example
+ ".qmlproject";
ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile.toString());
const Utils::FilePath qmlFile = Core::ICore::resourcePath() / "examples" / example
/ formFile;
ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile); Core::EditorManager::openEditor(qmlFile.toString());
const QString qmlFile = Core::ICore::resourcePath() + "/examples/" + example + "/"
+ formFile;
Core::EditorManager::openEditor(qmlFile);
} }
public slots: public slots:
void resetProjects(); void resetProjects();

View File

@@ -94,9 +94,7 @@ QByteArray CodeStylePoolPrivate::generateUniqueId(const QByteArray &id) const
static QString customCodeStylesPath() static QString customCodeStylesPath()
{ {
QString path = Core::ICore::userResourcePath(); return Core::ICore::userResourcePath().pathAppended("codestyles").toString();
path.append(QLatin1String("/codestyles/"));
return path;
} }
CodeStylePool::CodeStylePool(ICodeStylePreferencesFactory *factory, QObject *parent) CodeStylePool::CodeStylePool(ICodeStylePreferencesFactory *factory, QObject *parent)

View File

@@ -504,20 +504,19 @@ int FontSettings::defaultFontSize()
*/ */
QString FontSettings::defaultSchemeFileName(const QString &fileName) QString FontSettings::defaultSchemeFileName(const QString &fileName)
{ {
QString defaultScheme = Core::ICore::resourcePath(); Utils::FilePath defaultScheme = Core::ICore::resourcePath() / "styles";
defaultScheme += QLatin1String("/styles/");
if (!fileName.isEmpty() && QFile::exists(defaultScheme + fileName)) { if (!fileName.isEmpty() && (defaultScheme / fileName).exists()) {
defaultScheme += fileName; defaultScheme = defaultScheme / fileName;
} else { } else {
const QString themeScheme = Utils::creatorTheme()->defaultTextEditorColorScheme(); const QString themeScheme = Utils::creatorTheme()->defaultTextEditorColorScheme();
if (!themeScheme.isEmpty() && QFile::exists(defaultScheme + themeScheme)) if (!themeScheme.isEmpty() && (defaultScheme / themeScheme).exists())
defaultScheme += themeScheme; defaultScheme = defaultScheme / themeScheme;
else else
defaultScheme += QLatin1String("default.xml"); defaultScheme = defaultScheme / "default.xml";
} }
return defaultScheme; return defaultScheme.toString();
} }
} // namespace TextEditor } // namespace TextEditor

View File

@@ -191,9 +191,7 @@ public:
static QString customStylesPath() static QString customStylesPath()
{ {
QString path = Core::ICore::userResourcePath(); return Core::ICore::userResourcePath().pathAppended("styles").toString();
path.append(QLatin1String("/styles/"));
return path;
} }
static QString createColorSchemeFileName(const QString &pattern) static QString createColorSchemeFileName(const QString &pattern)
@@ -558,8 +556,7 @@ void FontSettingsPageWidget::refreshColorSchemeList()
{ {
QList<ColorSchemeEntry> colorSchemes; QList<ColorSchemeEntry> colorSchemes;
QString resourcePath = Core::ICore::resourcePath(); QDir styleDir(Core::ICore::resourcePath().pathAppended("styles").toDir());
QDir styleDir(resourcePath + QLatin1String("/styles"));
styleDir.setNameFilters(QStringList() << QLatin1String("*.xml")); styleDir.setNameFilters(QStringList() << QLatin1String("*.xml"));
styleDir.setFilter(QDir::Files); styleDir.setFilter(QDir::Files);

View File

@@ -59,7 +59,7 @@ KSyntaxHighlighting::Repository *highlightRepository()
if (!repository) { if (!repository) {
repository = new KSyntaxHighlighting::Repository(); repository = new KSyntaxHighlighting::Repository();
repository->addCustomSearchPath(TextEditorSettings::highlighterSettings().definitionFilesPath()); repository->addCustomSearchPath(TextEditorSettings::highlighterSettings().definitionFilesPath());
QDir dir(Core::ICore::resourcePath() + QLatin1String("/generic-highlighter/syntax")); QDir dir(Core::ICore::resourcePath().pathAppended("generic-highlighter/syntax").toDir());
if (dir.exists() && dir.cdUp()) if (dir.exists() && dir.cdUp())
repository->addCustomSearchPath(dir.path()); repository->addCustomSearchPath(dir.path());
} }

View File

@@ -88,7 +88,7 @@ QString findFallbackDefinitionsLocation()
} }
} }
dir.setPath(Core::ICore::resourcePath() + QLatin1String("/generic-highlighter")); dir.setPath(Core::ICore::resourcePath().pathAppended("generic-highlighter").toString());
if (dir.exists() && !dir.entryInfoList().isEmpty()) if (dir.exists() && !dir.entryInfoList().isEmpty())
return dir.path(); return dir.path();
@@ -165,8 +165,8 @@ void HighlighterSettings::assignDefaultIgnoredPatterns()
void HighlighterSettings::assignDefaultDefinitionsPath() void HighlighterSettings::assignDefaultDefinitionsPath()
{ {
const QString &path = const QString path
Core::ICore::userResourcePath() + QLatin1String("/generic-highlighter"); = Core::ICore::userResourcePath().pathAppended("generic-highlighter").toString();
if (QFile::exists(path) || QDir().mkpath(path)) if (QFile::exists(path) || QDir().mkpath(path))
m_definitionFilesPath = path; m_definitionFilesPath = path;
} }

View File

@@ -94,11 +94,11 @@ SnippetsCollection *SnippetsCollection::instance()
} }
// SnippetsCollection // SnippetsCollection
SnippetsCollection::SnippetsCollection() : SnippetsCollection::SnippetsCollection()
m_userSnippetsPath(Core::ICore::userResourcePath() + QLatin1String("/snippets/")), : m_userSnippetsPath(Core::ICore::userResourcePath().pathAppended("snippets/").toString())
m_userSnippetsFile(QLatin1String("snippets.xml")) , m_userSnippetsFile(QLatin1String("snippets.xml"))
{ {
QDir dir(Core::ICore::resourcePath() + QLatin1String("/snippets/")); QDir dir = Core::ICore::resourcePath().pathAppended("snippets").toDir();
dir.setNameFilters(QStringList(QLatin1String("*.xml"))); dir.setNameFilters(QStringList(QLatin1String("*.xml")));
foreach (const QFileInfo &fi, dir.entryInfoList()) foreach (const QFileInfo &fi, dir.entryInfoList())
m_builtInSnippetsFiles.append(fi.absoluteFilePath()); m_builtInSnippetsFiles.append(fi.absoluteFilePath());