diff options
79 files changed, 261 insertions, 245 deletions
diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index 3c59c6657f..7029c95f9c 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -890,6 +890,11 @@ QVariant FilePath::toVariant() const return m_data; } +QDir FilePath::toDir() const +{ + return QDir(m_data); +} + bool FilePath::operator==(const FilePath &other) const { if (!m_url.isEmpty()) diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h index 5cc1c0e9fc..ef3447dc4a 100644 --- a/src/libs/utils/fileutils.h +++ b/src/libs/utils/fileutils.h @@ -81,6 +81,7 @@ public: QString toString() const; QFileInfo toFileInfo() const; QVariant toVariant() const; + QDir toDir() const; QString toUserOutput() const; QString shortNativePath() const; diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 34593bb340..3125a4c116 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -91,7 +91,7 @@ static Q_LOGGING_CATEGORY(avdConfigLog, "qtc.android.androidconfig", QtWarningMs namespace Android { 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 CommonKey[] = "common"; const char SdkEssentialPkgsKey[] = "sdk_essential_packages"; @@ -142,7 +142,7 @@ namespace { static QString sdkSettingsFileName() { - return Core::ICore::installerResourcePath() + "/android.xml"; + return Core::ICore::installerResourcePath().pathAppended("android.xml").toString(); } static bool is32BitUserSpace() @@ -270,21 +270,22 @@ void AndroidConfig::save(QSettings &settings) const void AndroidConfig::parseDependenciesJson() { - QString sdkConfigUserFile(Core::ICore::userResourcePath() + JsonFilePath); - QString sdkConfigFile(Core::ICore::resourcePath() + JsonFilePath); + FilePath sdkConfigUserFile(Core::ICore::userResourcePath() / JsonFilePath); + FilePath sdkConfigFile(Core::ICore::resourcePath() / JsonFilePath); - if (!QFile::exists(sdkConfigUserFile)) { - QDir(QFileInfo(sdkConfigUserFile).absolutePath()).mkpath("."); - QFile::copy(sdkConfigFile, sdkConfigUserFile); + if (!sdkConfigUserFile.exists()) { + QDir(sdkConfigUserFile.toFileInfo().absolutePath()).mkpath("."); + QFile::copy(sdkConfigFile.toString(), sdkConfigUserFile.toString()); } - if (QFileInfo(sdkConfigFile).lastModified() > QFileInfo(sdkConfigUserFile).lastModified()) { - QFile::remove(sdkConfigUserFile + ".old"); - QFile::rename(sdkConfigUserFile, sdkConfigUserFile + ".old"); - QFile::copy(sdkConfigFile, sdkConfigUserFile); + if (sdkConfigFile.toFileInfo().lastModified() > sdkConfigUserFile.toFileInfo().lastModified()) { + const QString oldUserFile = (sdkConfigUserFile + ".old").toString(); + QFile::remove(oldUserFile); + QFile::rename(sdkConfigUserFile.toString(), oldUserFile); + QFile::copy(sdkConfigFile.toString(), sdkConfigUserFile.toString()); } - QFile jsonFile(sdkConfigUserFile); + QFile jsonFile(sdkConfigUserFile.toString()); if (!jsonFile.open(QIODevice::ReadOnly)) { qCDebug(avdConfigLog, "Couldn't open JSON config file %s.", qPrintable(jsonFile.fileName())); return; diff --git a/src/plugins/baremetal/debugserverprovidermanager.cpp b/src/plugins/baremetal/debugserverprovidermanager.cpp index 6ab84c0208..0808ddffd9 100644 --- a/src/plugins/baremetal/debugserverprovidermanager.cpp +++ b/src/plugins/baremetal/debugserverprovidermanager.cpp @@ -54,14 +54,14 @@ namespace Internal { const char dataKeyC[] = "DebugServerProvider."; const char countKeyC[] = "DebugServerProvider.Count"; const char fileVersionKeyC[] = "Version"; -const char fileNameKeyC[] = "/debugserverproviders.xml"; +const char fileNameKeyC[] = "debugserverproviders.xml"; static DebugServerProviderManager *m_instance = nullptr; // DebugServerProviderManager DebugServerProviderManager::DebugServerProviderManager() - : m_configFile(Utils::FilePath::fromString(Core::ICore::userResourcePath() + fileNameKeyC)) + : m_configFile(Core::ICore::userResourcePath() / fileNameKeyC) , m_factories({new GenericGdbServerProviderFactory, new JLinkGdbServerProviderFactory, new OpenOcdGdbServerProviderFactory, diff --git a/src/plugins/beautifier/abstractsettings.cpp b/src/plugins/beautifier/abstractsettings.cpp index 73df51d06c..11157cbe6a 100644 --- a/src/plugins/beautifier/abstractsettings.cpp +++ b/src/plugins/beautifier/abstractsettings.cpp @@ -47,11 +47,13 @@ const char COMMAND[] = "command"; const char SUPPORTED_MIME[] = "supportedMime"; } -AbstractSettings::AbstractSettings(const QString &name, const QString &ending) : - m_ending(ending), - m_styleDir(Core::ICore::userResourcePath() + '/' + Beautifier::Constants::SETTINGS_DIRNAME - + '/' + name), - m_name(name) +AbstractSettings::AbstractSettings(const QString &name, const QString &ending) + : m_ending(ending) + , m_styleDir(Core::ICore::userResourcePath() + .pathAppended(Beautifier::Constants::SETTINGS_DIRNAME) + .pathAppended(name) + .toString()) + , m_name(name) { } diff --git a/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp b/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp index d908eba363..f6e6def8bc 100644 --- a/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp +++ b/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp @@ -171,9 +171,10 @@ void ArtisticStyleSettings::setCustomStyle(const QString &customStyle) QString ArtisticStyleSettings::documentationFilePath() const { - return Core::ICore::userResourcePath() + '/' + Beautifier::Constants::SETTINGS_DIRNAME + '/' - + Beautifier::Constants::DOCUMENTATION_DIRNAME + '/' - + SETTINGS_NAME + ".xml"; + return (Core::ICore::userResourcePath() / Beautifier::Constants::SETTINGS_DIRNAME + / Beautifier::Constants::DOCUMENTATION_DIRNAME / SETTINGS_NAME + + ".xml") + .toString(); } void ArtisticStyleSettings::createDocumentationFile() const diff --git a/src/plugins/beautifier/clangformat/clangformatsettings.cpp b/src/plugins/beautifier/clangformat/clangformatsettings.cpp index d2b5416715..30e09619cf 100644 --- a/src/plugins/beautifier/clangformat/clangformatsettings.cpp +++ b/src/plugins/beautifier/clangformat/clangformatsettings.cpp @@ -56,9 +56,10 @@ ClangFormatSettings::ClangFormatSettings() : QString ClangFormatSettings::documentationFilePath() const { - return Core::ICore::userResourcePath() + '/' + Beautifier::Constants::SETTINGS_DIRNAME + '/' - + Beautifier::Constants::DOCUMENTATION_DIRNAME + '/' - + SETTINGS_NAME + ".xml"; + return (Core::ICore::userResourcePath() / Beautifier::Constants::SETTINGS_DIRNAME + / Beautifier::Constants::DOCUMENTATION_DIRNAME / SETTINGS_NAME + + ".xml") + .toString(); } void ClangFormatSettings::createDocumentationFile() const diff --git a/src/plugins/beautifier/uncrustify/uncrustifysettings.cpp b/src/plugins/beautifier/uncrustify/uncrustifysettings.cpp index 6f94d5e49f..db538328e6 100644 --- a/src/plugins/beautifier/uncrustify/uncrustifysettings.cpp +++ b/src/plugins/beautifier/uncrustify/uncrustifysettings.cpp @@ -140,9 +140,10 @@ void UncrustifySettings::setFormatEntireFileFallback(bool formatEntireFileFallba QString UncrustifySettings::documentationFilePath() const { - return Core::ICore::userResourcePath() + '/' + Beautifier::Constants::SETTINGS_DIRNAME + '/' - + Beautifier::Constants::DOCUMENTATION_DIRNAME + '/' - + SETTINGS_NAME + ".xml"; + return (Core::ICore::userResourcePath() / Beautifier::Constants::SETTINGS_DIRNAME + / Beautifier::Constants::DOCUMENTATION_DIRNAME / SETTINGS_NAME + + ".xml") + .toString(); } void UncrustifySettings::createDocumentationFile() const diff --git a/src/plugins/clangcodemodel/clangbackendcommunicator.cpp b/src/plugins/clangcodemodel/clangbackendcommunicator.cpp index 569645bd2d..d0d2355136 100644 --- a/src/plugins/clangcodemodel/clangbackendcommunicator.cpp +++ b/src/plugins/clangcodemodel/clangbackendcommunicator.cpp @@ -64,7 +64,7 @@ enum { backEndStartTimeOutInMs = 10000 }; static QString backendProcessPath() { - return Core::ICore::libexecPath() + "/clangbackend" + QTC_HOST_EXE_SUFFIX; + return (Core::ICore::libexecPath() / "clangbackend" + QTC_HOST_EXE_SUFFIX).toString(); } namespace ClangCodeModel { diff --git a/src/plugins/clangformat/clangformatconfigwidget.cpp b/src/plugins/clangformat/clangformatconfigwidget.cpp index f1fa2c82ce..956dac10e4 100644 --- a/src/plugins/clangformat/clangformatconfigwidget.cpp +++ b/src/plugins/clangformat/clangformatconfigwidget.cpp @@ -173,8 +173,7 @@ void ClangFormatConfigWidget::initChecksAndPreview() connect(m_ui->applyButton, &QPushButton::clicked, this, &ClangFormatConfigWidget::apply); fileName = m_project->projectFilePath().pathAppended("snippet.cpp"); } else { - fileName = Utils::FilePath::fromString(Core::ICore::userResourcePath()) - .pathAppended("snippet.cpp"); + fileName = Core::ICore::userResourcePath() / "snippet.cpp"; } m_preview->textDocument()->indenter()->setFileName(fileName); } @@ -240,10 +239,10 @@ void ClangFormatConfigWidget::showGlobalCheckboxes() static bool projectConfigExists() { - return Utils::FilePath::fromString(Core::ICore::userResourcePath()) + return Core::ICore::userResourcePath() .pathAppended("clang-format") .pathAppended(currentProjectUniqueId()) - .pathAppended((Constants::SETTINGS_FILE_NAME)) + .pathAppended(Constants::SETTINGS_FILE_NAME) .exists(); } @@ -478,7 +477,7 @@ void ClangFormatConfigWidget::apply() void ClangFormatConfigWidget::saveConfig(const std::string &text) const { - QString filePath = Core::ICore::userResourcePath(); + QString filePath = Core::ICore::userResourcePath().toString(); if (m_project) filePath += "/clang-format/" + currentProjectUniqueId(); filePath += "/" + QLatin1String(Constants::SETTINGS_FILE_NAME); diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp index da6e367f67..3dde622e4c 100644 --- a/src/plugins/clangformat/clangformatutils.cpp +++ b/src/plugins/clangformat/clangformatutils.cpp @@ -192,7 +192,7 @@ static bool useProjectOverriddenSettings() static Utils::FilePath globalPath() { - return Utils::FilePath::fromString(Core::ICore::userResourcePath()); + return Core::ICore::userResourcePath(); } static Utils::FilePath projectPath() diff --git a/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp b/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp index 808cf7b3eb..5782527fa4 100644 --- a/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp @@ -65,8 +65,7 @@ public: static const char CMAKE_TOOL_COUNT_KEY[] = "CMakeTools.Count"; static const char CMAKE_TOOL_DATA_KEY[] = "CMakeTools."; 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() { @@ -165,7 +164,7 @@ CMakeToolSettingsAccessor::CMakeToolSettingsAccessor() : QCoreApplication::translate("CMakeProjectManager::CMakeToolManager", "CMake"), 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>()); } @@ -174,8 +173,7 @@ CMakeToolSettingsAccessor::CMakeTools CMakeToolSettingsAccessor::restoreCMakeToo { CMakeTools result; - const FilePath sdkSettingsFile = FilePath::fromString(Core::ICore::installerResourcePath() - + CMAKE_TOOL_FILENAME); + const FilePath sdkSettingsFile = Core::ICore::installerResourcePath() / CMAKE_TOOL_FILENAME; CMakeTools sdkTools = cmakeTools(restoreSettings(sdkSettingsFile, parent), true); diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index 253c0d62e5..82681fc0a9 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -225,7 +225,7 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) expander->registerVariable("IDE:ResourcePath", tr("The directory where %1 finds its pre-installed resources.") .arg(Constants::IDE_DISPLAY_NAME), - []() { return ICore::resourcePath(); }); + []() { return ICore::resourcePath().toString(); }); expander->registerPrefix("CurrentDate:", tr("The current date (QDate formatstring)."), [](const QString &fmt) { return QDate::currentDate().toString(fmt); }); expander->registerPrefix("CurrentTime:", tr("The current time (QTime formatstring)."), diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index 87b713f453..01a5930912 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -632,23 +632,22 @@ void ExternalToolConfig::showInfoForItem(const QModelIndex &index) static QString getUserFilePath(const QString &proposalFileName) { - const QDir resourceDir(ICore::userResourcePath()); + const QDir resourceDir(ICore::userResourcePath().toDir()); if (!resourceDir.exists(QLatin1String("externaltools"))) resourceDir.mkpath(QLatin1String("externaltools")); const QFileInfo fi(proposalFileName); const QString &suffix = QLatin1Char('.') + fi.completeSuffix(); - const QString &newFilePath = ICore::userResourcePath() - + QLatin1String("/externaltools/") + fi.baseName(); + const FilePath newFilePath = ICore::userResourcePath() / "externaltools" / fi.baseName(); int count = 0; - QString tryPath = newFilePath + suffix; - while (QFile::exists(tryPath)) { + FilePath tryPath = newFilePath + suffix; + while (tryPath.exists()) { if (++count > 15) return QString(); // add random number const int number = QRandomGenerator::global()->generate() % 1000; tryPath = newFilePath + QString::number(number) + suffix; } - return tryPath; + return tryPath.toString(); } static QString idFromDisplayName(const QString &displayName) diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp index 83b6c279ce..3016e8b4b7 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp @@ -145,6 +145,11 @@ static bool isTextKeySequence(const QKeySequence &sequence) return false; } +static FilePath schemesPath() +{ + return Core::ICore::resourcePath() / "schemes"; +} + namespace Core { namespace Internal { @@ -485,9 +490,10 @@ void ShortcutSettingsWidget::resetToDefault() void ShortcutSettingsWidget::importAction() { - QString fileName = QFileDialog::getOpenFileName(ICore::dialogParent(), tr("Import Keyboard Mapping Scheme"), - ICore::resourcePath() + QLatin1String("/schemes/"), - tr("Keyboard Mapping Scheme (*.kms)")); + QString fileName = QFileDialog::getOpenFileName(ICore::dialogParent(), + tr("Import Keyboard Mapping Scheme"), + schemesPath().toString(), + tr("Keyboard Mapping Scheme (*.kms)")); if (!fileName.isEmpty()) { CommandsFile cf(fileName); @@ -524,10 +530,10 @@ void ShortcutSettingsWidget::defaultAction() void ShortcutSettingsWidget::exportAction() { - QString fileName = DocumentManager::getSaveFileNameWithExtension( - tr("Export Keyboard Mapping Scheme"), - ICore::resourcePath() + QLatin1String("/schemes/"), - tr("Keyboard Mapping Scheme (*.kms)")); + QString fileName + = DocumentManager::getSaveFileNameWithExtension(tr("Export Keyboard Mapping Scheme"), + schemesPath().toString(), + tr("Keyboard Mapping Scheme (*.kms)")); if (!fileName.isEmpty()) { CommandsFile cf(fileName); cf.exportCommands(m_scitems); diff --git a/src/plugins/coreplugin/externaltoolmanager.cpp b/src/plugins/coreplugin/externaltoolmanager.cpp index 99858beebd..8088446c48 100644 --- a/src/plugins/coreplugin/externaltoolmanager.cpp +++ b/src/plugins/coreplugin/externaltoolmanager.cpp @@ -90,10 +90,10 @@ ExternalToolManager::ExternalToolManager() QMap<QString, QMultiMap<int, ExternalTool*> > categoryPriorityMap; QMap<QString, ExternalTool *> tools; - parseDirectory(ICore::userResourcePath() + QLatin1String("/externaltools"), + parseDirectory(ICore::userResourcePath().pathAppended("externaltools").toString(), &categoryPriorityMap, &tools); - parseDirectory(ICore::resourcePath() + QLatin1String("/externaltools"), + parseDirectory(ICore::resourcePath().pathAppended("externaltools").toString(), &categoryPriorityMap, &tools, true); diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 8cab624ca3..28ef8279e3 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -132,15 +132,16 @@ void GeneralSettingsWidget::fillLanguageBox() const if (currentLocale == QLatin1String("C")) m_ui.languageBox->setCurrentIndex(m_ui.languageBox->count() - 1); - const QString creatorTrPath = ICore::resourcePath() + QLatin1String("/translations"); - const QStringList languageFiles = QDir(creatorTrPath).entryList(QStringList(QLatin1String("qtcreator*.qm"))); + const FilePath creatorTrPath = ICore::resourcePath() / "translations"; + const QStringList languageFiles = creatorTrPath.toDir().entryList( + QStringList(QLatin1String("qtcreator*.qm"))); for (const QString &languageFile : languageFiles) { int start = languageFile.indexOf('_') + 1; int end = languageFile.lastIndexOf('.'); const QString locale = languageFile.mid(start, end-start); // no need to show a language that creator will not load anyway - if (hasQmFilesForLocale(locale, creatorTrPath)) { + if (hasQmFilesForLocale(locale, creatorTrPath.toString())) { QLocale tmpLocale(locale); QString languageItem = QLocale::languageToString(tmpLocale.language()) + QLatin1String(" (") + QLocale::countryToString(tmpLocale.country()) + QLatin1Char(')'); diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index bdedc5404c..7e2396226d 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -396,9 +396,10 @@ QString ICore::userInterfaceLanguage() \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() */ -QString ICore::userResourcePath() +FilePath ICore::userResourcePath() { // Create qtcreator dir if it doesn't yet exist const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path(); @@ -423,24 +424,25 @@ QString ICore::userResourcePath() qWarning() << "could not create" << urp; } - return urp; + return FilePath::fromString(urp); } /*! 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 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 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()) - return libexecPath() + "/crashpad_reports/completed"; + return libexecPath() / "crashpad_reports/completed"; else - return libexecPath() + "/crashpad_reports/reports"; + return libexecPath() / "crashpad_reports/reports"; } QString ICore::ideDisplayName() @@ -505,10 +508,10 @@ static QString clangIncludePath(const QString &clangVersion) QString ICore::clangIncludeDirectory(const QString &clangVersion, const QString &clangFallbackIncludeDir) { - QDir dir(libexecPath() + "/clang" + clangIncludePath(clangVersion)); - if (!dir.exists() || !QFileInfo(dir, "stdint.h").exists()) - dir = QDir(clangFallbackIncludeDir); - return QDir::toNativeSeparators(dir.canonicalPath()); + FilePath dir = libexecPath() / "clang" + clangIncludePath(clangVersion); + if (!dir.exists() || !dir.pathAppended("stdint.h").exists()) + dir = FilePath::fromString(clangFallbackIncludeDir); + return dir.canonicalPath().toUserOutput(); } /*! @@ -517,10 +520,10 @@ QString ICore::clangIncludeDirectory(const QString &clangVersion, static QString clangBinary(const QString &binaryBaseName, const QString &clangBinDirectory) { 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()) - executable = QFileInfo(clangBinDirectory + "/" + binaryBaseName + hostExeSuffix); - return QDir::toNativeSeparators(executable.canonicalFilePath()); + executable = FilePath::fromString(clangBinDirectory) / binaryBaseName + hostExeSuffix; + return executable.canonicalPath().toUserOutput(); } /*! diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index 93827be047..64729d9f38 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -28,6 +28,7 @@ #include "core_global.h" #include "icontext.h" +#include <utils/fileutils.h> #include <utils/qtcsettings.h> #include <QList> @@ -94,12 +95,12 @@ public: static QPrinter *printer(); static QString userInterfaceLanguage(); - static QString resourcePath(); - static QString userResourcePath(); - static QString cacheResourcePath(); - static QString installerResourcePath(); - static QString libexecPath(); - static QString crashReportsPath(); + static Utils::FilePath resourcePath(); + static Utils::FilePath userResourcePath(); + static Utils::FilePath cacheResourcePath(); + static Utils::FilePath installerResourcePath(); + static Utils::FilePath libexecPath(); + static Utils::FilePath crashReportsPath(); static QString ideDisplayName(); diff --git a/src/plugins/coreplugin/mimetypesettings.cpp b/src/plugins/coreplugin/mimetypesettings.cpp index 5cfe6ea84c..24586d688c 100644 --- a/src/plugins/coreplugin/mimetypesettings.cpp +++ b/src/plugins/coreplugin/mimetypesettings.cpp @@ -502,8 +502,8 @@ void MimeTypeSettingsPrivate::ensurePendingMimeType(const Utils::MimeType &mimeT void MimeTypeSettingsPrivate::writeUserModifiedMimeTypes() { - static Utils::FilePath modifiedMimeTypesFile = Utils::FilePath::fromString( - ICore::userResourcePath() + QLatin1String(kModifiedMimeTypesFile)); + static Utils::FilePath modifiedMimeTypesFile = ICore::userResourcePath() + + kModifiedMimeTypesFile; if (QFile::exists(modifiedMimeTypesFile.toString()) || QDir().mkpath(modifiedMimeTypesFile.parentDir().toString())) { @@ -564,10 +564,10 @@ static QPair<int, int> rangeFromString(const QString &offset) MimeTypeSettingsPrivate::UserMimeTypeHash MimeTypeSettingsPrivate::readUserModifiedMimeTypes() { - static QString modifiedMimeTypesPath = ICore::userResourcePath() - + QLatin1String(kModifiedMimeTypesFile); + static Utils::FilePath modifiedMimeTypesPath = ICore::userResourcePath() + + kModifiedMimeTypesFile; UserMimeTypeHash userMimeTypes; - QFile file(modifiedMimeTypesPath); + QFile file(modifiedMimeTypesPath.toString()); if (file.open(QFile::ReadOnly)) { UserMimeType mt; QXmlStreamReader reader(&file); diff --git a/src/plugins/coreplugin/themechooser.cpp b/src/plugins/coreplugin/themechooser.cpp index 13af462167..8fb3ece1e3 100644 --- a/src/plugins/coreplugin/themechooser.cpp +++ b/src/plugins/coreplugin/themechooser.cpp @@ -211,19 +211,19 @@ QList<ThemeEntry> ThemeEntry::availableThemes() { QList<ThemeEntry> themes; - static const QString installThemeDir = ICore::resourcePath() + QLatin1String("/themes"); - static const QString userThemeDir = ICore::userResourcePath() + QLatin1String("/themes"); - addThemesFromPath(installThemeDir, &themes); + static const FilePath installThemeDir = ICore::resourcePath() + QLatin1String("/themes"); + static const FilePath userThemeDir = ICore::userResourcePath() + QLatin1String("/themes"); + addThemesFromPath(installThemeDir.toString(), &themes); if (themes.isEmpty()) qWarning() << "Warning: No themes found in installation: " - << QDir::toNativeSeparators(installThemeDir); + << installThemeDir.toUserOutput(); // move default theme to front int defaultIndex = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, Id(Constants::DEFAULT_THEME))); if (defaultIndex > 0) { // == exists and not at front ThemeEntry defaultEntry = themes.takeAt(defaultIndex); themes.prepend(defaultEntry); } - addThemesFromPath(userThemeDir, &themes); + addThemesFromPath(userThemeDir.toString(), &themes); return themes; } diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index b40d6e1ac8..030d2b16cd 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -303,7 +303,7 @@ void CompilerOptionsBuilder::insertWrappedMingwHeaders() static QString creatorResourcePath() { #ifndef UNIT_TESTS - return Core::ICore::resourcePath(); + return Core::ICore::resourcePath().toString(); #else return QDir::toNativeSeparators(QString::fromUtf8(QTC_RESOURCE_DIR "")); #endif diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index c530b063c0..42d6f479a1 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -2755,7 +2755,7 @@ void CdbEngine::setupScripting(const DebuggerResponse &response) return; } - QString dumperPath = QDir::toNativeSeparators(Core::ICore::resourcePath() + "/debugger"); + QString dumperPath = Core::ICore::resourcePath().pathAppended("debugger").toUserOutput(); dumperPath.replace('\\', "\\\\"); runCommand({"sys.path.insert(1, '" + dumperPath + "')", ScriptCommand}); runCommand({"from cdbbridge import Dumper", ScriptCommand}); diff --git a/src/plugins/debugger/debuggeritemmanager.cpp b/src/plugins/debugger/debuggeritemmanager.cpp index 8c62f0c02e..d9aa9ce07d 100644 --- a/src/plugins/debugger/debuggeritemmanager.cpp +++ b/src/plugins/debugger/debuggeritemmanager.cpp @@ -72,7 +72,7 @@ namespace Internal { const char DEBUGGER_COUNT_KEY[] = "DebuggerItem.Count"; const char DEBUGGER_DATA_KEY[] = "DebuggerItem."; 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"; class DebuggerItemModel; @@ -835,7 +835,7 @@ void DebuggerItemManagerPrivate::autoDetectUvscDebuggers() static FilePath userSettingsFileName() { - return FilePath::fromString(ICore::userResourcePath() + DEBUGGER_FILENAME); + return ICore::userResourcePath() / DEBUGGER_FILENAME; } DebuggerItemManagerPrivate::DebuggerItemManagerPrivate() @@ -931,7 +931,7 @@ void DebuggerItemManagerPrivate::readDebuggers(const FilePath &fileName, bool is void DebuggerItemManagerPrivate::restoreDebuggers() { // Read debuggers from SDK - readDebuggers(FilePath::fromString(ICore::installerResourcePath() + DEBUGGER_FILENAME), true); + readDebuggers(ICore::installerResourcePath() / DEBUGGER_FILENAME, true); // Read all debuggers from user file. readDebuggers(userSettingsFileName(), false); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 74cee5d0ef..e100c6ff06 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -3970,7 +3970,7 @@ void GdbEngine::setupEngine() // We need to guarantee a roundtrip before the adapter proceeds. // Make sure this stays the last command in startGdb(). // 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()) // runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice())}); diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 7618fee0a2..a7878a4b0d 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -232,8 +232,8 @@ void LldbEngine::setupEngine() showStatusMessage(tr("Setting up inferior...")); - const QByteArray dumperSourcePath = - ICore::resourcePath().toLocal8Bit() + "/debugger/"; + const QByteArray dumperSourcePath = ICore::resourcePath().toString().toLocal8Bit() + + "/debugger/"; executeCommand("script sys.path.insert(1, '" + dumperSourcePath + "')"); // This triggers reportState("enginesetupok") or "enginesetupfailed": diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index 053903ebe2..94838f458f 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -115,7 +115,7 @@ void PdbEngine::setupEngine() QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); 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, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), diff --git a/src/plugins/designer/formeditorplugin.cpp b/src/plugins/designer/formeditorplugin.cpp index 9a912ac68e..5b37694552 100644 --- a/src/plugins/designer/formeditorplugin.cpp +++ b/src/plugins/designer/formeditorplugin.cpp @@ -106,9 +106,9 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error) const QString locale = ICore::userInterfaceLanguage(); if (!locale.isEmpty()) { auto qtr = new QTranslator(this); - const QString &creatorTrPath = ICore::resourcePath() + "/translations"; - const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); - const QString &trFile = "designer_" + locale; + const QString creatorTrPath = ICore::resourcePath().pathAppended("translations").toString(); + const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + const QString trFile = "designer_" + locale; if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath)) QCoreApplication::installTranslator(qtr); } diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp index ca953fc90f..d96c1ef082 100644 --- a/src/plugins/glsleditor/glsleditorplugin.cpp +++ b/src/plugins/glsleditor/glsleditorplugin.cpp @@ -84,7 +84,7 @@ void GlslEditorPlugin::InitFile::initialize() const const int variant = GLSL::Lexer::Variant_All; QByteArray code; - QFile file(ICore::resourcePath() + "/glsl/" + m_fileName); + QFile file(ICore::resourcePath().pathAppended("glsl").pathAppended(m_fileName).toString()); if (file.open(QFile::ReadOnly)) code = file.readAll(); diff --git a/src/plugins/help/helpmanager.cpp b/src/plugins/help/helpmanager.cpp index 91b2f2b640..77c7bf2815 100644 --- a/src/plugins/help/helpmanager.cpp +++ b/src/plugins/help/helpmanager.cpp @@ -125,8 +125,7 @@ HelpManager *HelpManager::instance() QString HelpManager::collectionFilePath() { - return QDir::cleanPath(ICore::userResourcePath() - + QLatin1String("/helpcollection.qhc")); + return ICore::userResourcePath().pathAppended("helpcollection.qhc").toString(); } void HelpManager::registerDocumentation(const QStringList &files) diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 00a1b28e5a..8dbccfa88d 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -189,14 +189,14 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) HelpPluginPrivate::HelpPluginPrivate() { - const QString &locale = ICore::userInterfaceLanguage(); + const QString locale = ICore::userInterfaceLanguage(); if (!locale.isEmpty()) { auto qtr = new QTranslator(this); auto qhelptr = new QTranslator(this); - const QString &creatorTrPath = ICore::resourcePath() + "/translations"; - const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); - const QString &trFile = QLatin1String("assistant_") + locale; - const QString &helpTrFile = QLatin1String("qt_help_") + locale; + const QString creatorTrPath = ICore::resourcePath().pathAppended("translations").toString(); + const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + const QString trFile = QLatin1String("assistant_") + locale; + const QString helpTrFile = QLatin1String("qt_help_") + locale; if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath)) QCoreApplication::installTranslator(qtr); if (qhelptr->load(helpTrFile, qtTrPath) || qhelptr->load(helpTrFile, creatorTrPath)) diff --git a/src/plugins/help/macwebkithelpviewer.mm b/src/plugins/help/macwebkithelpviewer.mm index 1cb2aa2596..be8a1c1c17 100644 --- a/src/plugins/help/macwebkithelpviewer.mm +++ b/src/plugins/help/macwebkithelpviewer.mm @@ -584,8 +584,9 @@ void MacWebKitHelpViewer::setHtml(const QString &html) { @autoreleasepool { [m_widget->webView().mainFrame - loadHTMLString:html.toNSString() - baseURL:[NSURL fileURLWithPath:Core::ICore::resourcePath().toNSString()]]; + loadHTMLString:html.toNSString() + baseURL:[NSURL + fileURLWithPath:Core::ICore::resourcePath().toString().toNSString()]]; } } diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp index f9318712a6..855a8a0444 100644 --- a/src/plugins/ios/iostoolhandler.cpp +++ b/src/plugins/ios/iostoolhandler.cpp @@ -1015,8 +1015,7 @@ bool IosSimulatorToolHandlerPrivate::isResponseValid(const SimulatorControl::Res QString IosToolHandler::iosDeviceToolPath() { - QString res = Core::ICore::libexecPath() + QLatin1String("/ios/iostool"); - return res; + return Core::ICore::libexecPath().pathAppended("ios/iostool").toString(); } IosToolHandler::IosToolHandler(const Internal::IosDeviceType &devType, QObject *parent) : diff --git a/src/plugins/macros/macromanager.cpp b/src/plugins/macros/macromanager.cpp index 085a8fd032..6d70e48bb5 100644 --- a/src/plugins/macros/macromanager.cpp +++ b/src/plugins/macros/macromanager.cpp @@ -386,8 +386,7 @@ void MacroManager::saveLastMacro() QString MacroManager::macrosDirectory() { - const QString &path = - Core::ICore::userResourcePath() + QLatin1String("/macros"); + const QString path = Core::ICore::userResourcePath().pathAppended("macros").toString(); if (QFile::exists(path) || QDir().mkpath(path)) return path; return QString(); diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index e07caa86ff..9803541c8a 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -762,7 +762,7 @@ static void setKitEnvironment(Kit *k, const McuTarget *mcuTarget, if (mcuTarget->qulVersion() < QVersionNumber{1,7}) { const QString path = QLatin1String(HostOsInfo::isWindowsHost() ? "Path" : "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())}); } diff --git a/src/plugins/mesonprojectmanager/machinefiles/machinefilemanager.cpp b/src/plugins/mesonprojectmanager/machinefiles/machinefilemanager.cpp index 390d4a9190..740dfa900e 100644 --- a/src/plugins/mesonprojectmanager/machinefiles/machinefilemanager.cpp +++ b/src/plugins/mesonprojectmanager/machinefiles/machinefilemanager.cpp @@ -57,8 +57,7 @@ bool withFile(const Utils::FilePath &path, const F &f) Utils::FilePath MachineFilesDir() { - return Utils::FilePath::fromString(Core::ICore::userResourcePath()) - .pathAppended("Meson-machine-files"); + return Core::ICore::userResourcePath() / "Meson-machine-files"; } MachineFileManager::MachineFileManager() diff --git a/src/plugins/mesonprojectmanager/settings/tools/toolssettingsaccessor.cpp b/src/plugins/mesonprojectmanager/settings/tools/toolssettingsaccessor.cpp index fc20ca4784..531f27caa0 100644 --- a/src/plugins/mesonprojectmanager/settings/tools/toolssettingsaccessor.cpp +++ b/src/plugins/mesonprojectmanager/settings/tools/toolssettingsaccessor.cpp @@ -54,8 +54,7 @@ ToolsSettingsAccessor::ToolsSettingsAccessor() "Meson"), Core::Constants::IDE_DISPLAY_NAME) { - setBaseFilePath(Utils::FilePath::fromString(Core::ICore::userResourcePath()) - .pathAppended(Constants::ToolsSettings::FILENAME)); + setBaseFilePath(Core::ICore::userResourcePath() / Constants::ToolsSettings::FILENAME); } void ToolsSettingsAccessor::saveMesonTools(const std::vector<MesonTools::Tool_t> &tools, diff --git a/src/plugins/modeleditor/modelsmanager.cpp b/src/plugins/modeleditor/modelsmanager.cpp index da02d47462..a2a5b8f065 100644 --- a/src/plugins/modeleditor/modelsmanager.cpp +++ b/src/plugins/modeleditor/modelsmanager.cpp @@ -140,10 +140,9 @@ ModelsManager::~ModelsManager() ExtDocumentController *ModelsManager::createModel(ModelDocument *modelDocument) { auto documentController = new ExtDocumentController(this); - QDir dir; - dir.setPath(Core::ICore::resourcePath() + QLatin1String("/modeleditor")); // 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)); return documentController; diff --git a/src/plugins/perfprofiler/perfdatareader.cpp b/src/plugins/perfprofiler/perfdatareader.cpp index f9f32a7df3..783037cd07 100644 --- a/src/plugins/perfprofiler/perfdatareader.cpp +++ b/src/plugins/perfprofiler/perfdatareader.cpp @@ -406,8 +406,8 @@ QString PerfDataReader::findPerfParser() { QString filePath = QString::fromLocal8Bit(qgetenv("PERFPROFILER_PARSER_FILEPATH")); if (filePath.isEmpty()) { - filePath = QString::fromLatin1("%1/perfparser%2").arg(Core::ICore::libexecPath(), - QString(QTC_HOST_EXE_SUFFIX)); + filePath = QString::fromLatin1("%1/perfparser%2") + .arg(Core::ICore::libexecPath().toString(), QString(QTC_HOST_EXE_SUFFIX)); } return QDir::toNativeSeparators(QDir::cleanPath(filePath)); } diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp index 55850c4333..2f261faa22 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp @@ -383,13 +383,11 @@ QList<Core::IWizardFactory *> CustomWizard::createWizards() { QString errorMessage; QString verboseLog; - const QString templateDirName = Core::ICore::resourcePath() + - QLatin1Char('/') + QLatin1String(templatePathC); - - - const QString userTemplateDirName = Core::ICore::userResourcePath() + - QLatin1Char('/') + QLatin1String(templatePathC); + const QString templateDirName + = Core::ICore::resourcePath().pathAppended(templatePathC).toString(); + const QString userTemplateDirName + = Core::ICore::userResourcePath().pathAppended(templatePathC).toString(); const QDir templateDir(templateDirName); if (CustomWizardPrivate::verbose) diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp index bbf6e4bcd8..61ec737887 100644 --- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp @@ -225,13 +225,12 @@ QVariantMap DeviceManager::toMap() const 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) { - return Utils::FilePath::fromString(Core::ICore::installerResourcePath() - + deviceFileRelativePath); + return Core::ICore::installerResourcePath() + deviceFileRelativePath; } void DeviceManager::addDevice(const IDevice::ConstPtr &_device) diff --git a/src/plugins/projectexplorer/extraabi.cpp b/src/plugins/projectexplorer/extraabi.cpp index 855d4a9e9c..cab1ebd29a 100644 --- a/src/plugins/projectexplorer/extraabi.cpp +++ b/src/plugins/projectexplorer/extraabi.cpp @@ -65,7 +65,7 @@ AbiFlavorAccessor::AbiFlavorAccessor() : QCoreApplication::translate("ProjectExplorer::ToolChainManager", "ABI"), Core::Constants::IDE_DISPLAY_NAME) { - setBaseFilePath(FilePath::fromString(Core::ICore::installerResourcePath() + "/abi.xml")); + setBaseFilePath(Core::ICore::installerResourcePath() / "abi.xml"); addVersionUpgrader(std::make_unique<AbiFlavorUpgraderV0>()); } diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard_test.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard_test.cpp index 0669f9584b..d5783c9b21 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard_test.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard_test.cpp @@ -257,7 +257,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testJsonWizardsComboBox() static QString iconInsideResource(const QString &relativePathToIcon) { - const QDir resourcePath(Core::ICore::resourcePath()); + const QDir resourcePath(Core::ICore::resourcePath().toDir()); return resourcePath.filePath(relativePathToIcon); } diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp index 77aada4606..c22aab9e96 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp @@ -336,11 +336,8 @@ static QStringList environmentTemplatesPaths() Utils::FilePaths &JsonWizardFactory::searchPaths() { - static Utils::FilePaths m_searchPaths = Utils::FilePaths() - << Utils::FilePath::fromString(Core::ICore::userResourcePath() + QLatin1Char('/') + - QLatin1String(WIZARD_PATH)) - << Utils::FilePath::fromString(Core::ICore::resourcePath() + QLatin1Char('/') + - QLatin1String(WIZARD_PATH)); + static Utils::FilePaths m_searchPaths = {Core::ICore::userResourcePath() / WIZARD_PATH, + Core::ICore::resourcePath() / WIZARD_PATH}; for (const QString &environmentTemplateDirName : environmentTemplatesPaths()) m_searchPaths << Utils::FilePath::fromString(environmentTemplateDirName); diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index f1100358aa..197b179a92 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -79,11 +79,11 @@ const char KIT_COUNT_KEY[] = "Profile.Count"; const char KIT_FILE_VERSION_KEY[] = "Version"; const char KIT_DEFAULT_KEY[] = "Profile.Default"; const char KIT_IRRELEVANT_ASPECTS_KEY[] = "Kit.IrrelevantAspects"; -const char KIT_FILENAME[] = "/profiles.xml"; +const char KIT_FILENAME[] = "profiles.xml"; 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 { - KitList system = restoreKitsHelper - (FilePath::fromString(ICore::installerResourcePath() + KIT_FILENAME)); + KitList system = restoreKitsHelper(ICore::installerResourcePath() / KIT_FILENAME); // SDK kits need to get updated with the user-provided extra settings: for (auto ¤t : system.kits) { diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 337ee21c86..b66b0993d8 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -2049,8 +2049,7 @@ void ProjectExplorerPlugin::extensionsInitialized() QSsh::SshSettings::loadSettings(Core::ICore::settings()); const auto searchPathRetriever = [] { - Utils::FilePaths searchPaths; - searchPaths << Utils::FilePath::fromString(Core::ICore::libexecPath()); + Utils::FilePaths searchPaths = {Core::ICore::libexecPath()}; if (Utils::HostOsInfo::isWindowsHost()) { const QString gitBinary = Core::ICore::settings()->value("Git/BinaryPath", "git") .toString(); diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 1542cbe3cc..3520cd5fc1 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -768,7 +768,7 @@ QStringList SessionManager::sessions() { if (d->m_sessions.isEmpty()) { // 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); foreach (const QFileInfo &fileInfo, sessionFiles) { const QString &name = fileInfo.completeBaseName(); @@ -788,7 +788,7 @@ QDateTime SessionManager::sessionDateTime(const QString &session) FilePath SessionManager::sessionNameToFileName(const QString &session) { - return FilePath::fromString(ICore::userResourcePath() + QLatin1Char('/') + session + QLatin1String(".qws")); + return ICore::userResourcePath() / session + ".qws"; } /*! diff --git a/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp b/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp index 7142ffdce9..3ba808307b 100644 --- a/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp +++ b/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp @@ -58,7 +58,7 @@ public: static const char TOOLCHAIN_DATA_KEY[] = "ToolChain."; static const char TOOLCHAIN_COUNT_KEY[] = "ToolChain.Count"; -static const char TOOLCHAIN_FILENAME[] = "/toolchains.xml"; +static const char TOOLCHAIN_FILENAME[] = "toolchains.xml"; struct ToolChainOperations { @@ -184,7 +184,7 @@ ToolChainSettingsAccessor::ToolChainSettingsAccessor() : QCoreApplication::translate("ProjectExplorer::ToolChainManager", "Tool Chains"), Core::Constants::IDE_DISPLAY_NAME) { - setBaseFilePath(FilePath::fromString(Core::ICore::userResourcePath() + TOOLCHAIN_FILENAME)); + setBaseFilePath(Core::ICore::userResourcePath() / TOOLCHAIN_FILENAME); addVersionUpgrader(std::make_unique<ToolChainSettingsUpgraderV0>()); } @@ -192,9 +192,8 @@ ToolChainSettingsAccessor::ToolChainSettingsAccessor() : QList<ToolChain *> ToolChainSettingsAccessor::restoreToolChains(QWidget *parent) const { // read all tool chains from SDK - const QList<ToolChain *> systemFileTcs - = toolChains(restoreSettings(FilePath::fromString(Core::ICore::installerResourcePath() + TOOLCHAIN_FILENAME), - parent)); + const QList<ToolChain *> systemFileTcs = toolChains( + restoreSettings(Core::ICore::installerResourcePath() / TOOLCHAIN_FILENAME, parent)); for (ToolChain * const systemTc : systemFileTcs) systemTc->setDetection(ToolChain::AutoDetectionFromSdk); diff --git a/src/plugins/qbsprojectmanager/qbssettings.cpp b/src/plugins/qbsprojectmanager/qbssettings.cpp index e3200a0ae0..de6b1ad9da 100644 --- a/src/plugins/qbsprojectmanager/qbssettings.cpp +++ b/src/plugins/qbsprojectmanager/qbssettings.cpp @@ -85,7 +85,7 @@ bool QbsSettings::useCreatorSettingsDirForQbs() QString QbsSettings::qbsSettingsBaseDir() { - return useCreatorSettingsDirForQbs() ? Core::ICore::userResourcePath() : QString(); + return useCreatorSettingsDirForQbs() ? Core::ICore::userResourcePath().toString() : QString(); } QbsSettings &QbsSettings::instance() diff --git a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp index 70a489dd07..9c8368e98b 100644 --- a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp @@ -102,9 +102,7 @@ bool QtWizard::qt4ProjectPostGenerateFiles(const QWizard *w, QString QtWizard::templateDir() { - QString rc = Core::ICore::resourcePath(); - rc += QLatin1String("/templates/qt4project"); - return rc; + return Core::ICore::resourcePath().pathAppended("templates/qt4project").toString(); } bool QtWizard::lowerCaseFiles() diff --git a/src/plugins/qmldesigner/components/componentcore/qmldesignericonprovider.cpp b/src/plugins/qmldesigner/components/componentcore/qmldesignericonprovider.cpp index a1ca4a42dc..9cf335c0b1 100644 --- a/src/plugins/qmldesigner/components/componentcore/qmldesignericonprovider.cpp +++ b/src/plugins/qmldesigner/components/componentcore/qmldesignericonprovider.cpp @@ -44,7 +44,9 @@ QmlDesignerIconProvider::QmlDesignerIconProvider() 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) diff --git a/src/plugins/qmldesigner/components/componentcore/theme.cpp b/src/plugins/qmldesigner/components/componentcore/theme.cpp index 2c31414db3..a48a70ac7f 100644 --- a/src/plugins/qmldesigner/components/componentcore/theme.cpp +++ b/src/plugins/qmldesigner/components/componentcore/theme.cpp @@ -49,8 +49,11 @@ Theme::Theme(Utils::Theme *originTheme, QObject *parent) : Utils::Theme(originTheme, parent) , m_constants(nullptr) { - QString constantsPath = Core::ICore::resourcePath() + - QStringLiteral("/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml"); + QString constantsPath + = Core::ICore::resourcePath() + .pathAppended( + "qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml") + .toString(); QQmlEngine* engine = new QQmlEngine(this); QQmlComponent component(engine, QUrl::fromLocalFile(constantsPath)); diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp index 151e6c5a59..b67eb8cf15 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp @@ -65,8 +65,8 @@ ProjectExplorer::Target *activeTarget(ProjectExplorer::Project *project) class ImageCacheData { public: - Sqlite::Database database{ - Utils::PathString{Core::ICore::cacheResourcePath() + "/imagecache-v2.db"}}; + Sqlite::Database database{Utils::PathString{ + Core::ICore::cacheResourcePath().pathAppended("imagecache-v2.db").toString()}}; ImageCacheStorage<Sqlite::Database> storage{database}; ImageCacheConnectionManager connectionManager; ImageCacheCollector collector{connectionManager}; diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index 290611e2e0..df847796a7 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -76,7 +76,9 @@ namespace QmlDesigner { 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) @@ -324,7 +326,7 @@ void ItemLibraryWidget::handleTabChanged(int index) QString ItemLibraryWidget::qmlSourcesPath() { - return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/itemLibraryQmlSources"); + return Core::ICore::resourcePath().pathAppended("qmldesigner/itemLibraryQmlSources").toString(); } void ItemLibraryWidget::clearSearchFilter() diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientpresetcustomlistmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/gradientpresetcustomlistmodel.cpp index 64008fade5..bf1bcd28dd 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/gradientpresetcustomlistmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/gradientpresetcustomlistmodel.cpp @@ -39,14 +39,14 @@ namespace Internal { static const char settingsKey[] = "GradientPresetCustomList"; -static const char settingsFileName[] = "/GradientPresets.ini"; +static const char settingsFileName[] = "GradientPresets.ini"; QString settingsFullFilePath(const QSettings::Scope &scope) { 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 diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index e498d20156..9a75b2515e 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -531,7 +531,9 @@ void PropertyEditorQmlBackend::initialSetup(const TypeName &typeName, const QUrl } 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) diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp index b6b301b855..5c8e52e9be 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp @@ -57,7 +57,9 @@ enum { namespace QmlDesigner { static QString propertyEditorResourcesPath() { - return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/propertyEditorQmlSources"); + return Core::ICore::resourcePath() + .pathAppended("qmldesigner/propertyEditorQmlSources") + .toString(); } int StatesEditorWidget::currentStateInternalId() const @@ -120,7 +122,7 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, State StatesEditorWidget::~StatesEditorWidget() = default; QString StatesEditorWidget::qmlSourcesPath() { - return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/statesEditorQmlSources"); + return Core::ICore::resourcePath().pathAppended("qmldesigner/statesEditorQmlSources").toString(); } void StatesEditorWidget::toggleStatesViewExpanded() diff --git a/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp b/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp index fd17b10d9a..a99f8a7c0a 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp @@ -141,14 +141,14 @@ QIcon paintPreview(const EasingCurve &curve, const QColor& background, const QCo namespace Internal { static const char settingsKey[] = "EasingCurveList"; -static const char settingsFileName[] = "/EasingCurves.ini"; +static const char settingsFileName[] = "EasingCurves.ini"; QString settingsFullFilePath(const QSettings::Scope &scope) { 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 diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index acf3083b3e..2949918541 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -392,7 +392,7 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing() QString PuppetCreator::defaultPuppetToplevelBuildDirectory() { - return Core::ICore::userResourcePath() + "/qmlpuppet/"; + return Core::ICore::userResourcePath().pathAppended("qmlpuppet/").toString(); } QString PuppetCreator::qmlPuppetToplevelBuildDirectory() const @@ -424,9 +424,9 @@ QString PuppetCreator::qmlPuppetDirectory(PuppetType puppetType) const QString PuppetCreator::defaultPuppetFallbackDirectory() { if (Utils::HostOsInfo::isMacHost()) - return Core::ICore::libexecPath() + "/qmldesigner"; + return Core::ICore::libexecPath().pathAppended("qmldesigner").toString(); else - return Core::ICore::libexecPath(); + return Core::ICore::libexecPath().toString(); } QString PuppetCreator::qmlPuppetFallbackDirectory(const DesignerSettings &settings) @@ -639,7 +639,7 @@ bool PuppetCreator::startBuildProcess(const QString &buildDirectoryPath, QString PuppetCreator::puppetSourceDirectoryPath() { - return Core::ICore::resourcePath() + "/qml/qmlpuppet"; + return Core::ICore::resourcePath().pathAppended("qml/qmlpuppet").toString(); } QString PuppetCreator::qml2PuppetProjectFile() diff --git a/src/plugins/qmldesigner/designermcumanager.cpp b/src/plugins/qmldesigner/designermcumanager.cpp index 45bdde3b51..63efcb305d 100644 --- a/src/plugins/qmldesigner/designermcumanager.cpp +++ b/src/plugins/qmldesigner/designermcumanager.cpp @@ -64,7 +64,7 @@ DesignerMcuManager &DesignerMcuManager::instance() QString DesignerMcuManager::mcuResourcesPath() { - return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/qt4mcu"); + return Core::ICore::resourcePath().pathAppended("qmldesigner/qt4mcu").toString(); } bool DesignerMcuManager::isMCUProject() const diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index 4c485c02b3..37b1d9fefb 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -234,7 +234,8 @@ void DesignModeWidget::setup() ADS::DockManager::setConfigFlag(ADS::DockManager::AllTabsHaveCloseButton, true); m_dockManager = new ADS::DockManager(this); 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")); m_dockManager->setStyleSheet(Theme::replaceCssColors(sheet)); diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index 1d56ef0e8c..908debcdb7 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -211,7 +211,7 @@ QmlDesignerPlugin::~QmlDesignerPlugin() //////////////////////////////////////////////////// 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)) return false; @@ -219,8 +219,10 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e if (DesignerSettings::getValue(DesignerSettingsKey::STANDALONE_MODE).toBool()) GenerateResource::generateMenuEntry(); - QString fontPath = Core::ICore::resourcePath() + - QStringLiteral("/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf"); + const QString fontPath + = Core::ICore::resourcePath() + .pathAppended("qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf") + .toString(); if (QFontDatabase::addApplicationFont(fontPath) < 0) qCWarning(qmldesignerLog) << "Could not add font " << fontPath << "to font database"; diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 7414a1a972..da4a137645 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -92,8 +92,9 @@ public: QPointer<QmlJSEditorDocument> m_currentDocument; - Utils::JsonSchemaManager m_jsonManager{{ICore::userResourcePath() + "/json/", - ICore::resourcePath() + "/json/"}}; + Utils::JsonSchemaManager m_jsonManager{ + {ICore::userResourcePath().pathAppended("json/").toString(), + ICore::resourcePath().pathAppended("json/").toString()}}; QmlJSEditorFactory m_qmlJSEditorFactory; QmlJSOutlineWidgetFactory m_qmlJSOutlineWidgetFactory; QuickToolBar m_quickToolBar; diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp index 8110110809..ed5b0d1499 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.cpp +++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp @@ -328,8 +328,8 @@ QmlOutlineModel::QmlOutlineModel(QmlJSEditorDocument *document) : m_editorDocument(document) { m_icons = Icons::instance(); - const QString resourcePath = Core::ICore::resourcePath(); - Icons::instance()->setIconFilesPath(resourcePath + QLatin1String("/qmlicons")); + Icons::instance()->setIconFilesPath( + Core::ICore::resourcePath().pathAppended("qmlicons").toString()); setItemPrototype(new QmlOutlineItem(this)); } diff --git a/src/plugins/qmljstools/qmljsbundleprovider.cpp b/src/plugins/qmljstools/qmljsbundleprovider.cpp index 176d66b33d..61ff8eddda 100644 --- a/src/plugins/qmljstools/qmljsbundleprovider.cpp +++ b/src/plugins/qmljstools/qmljsbundleprovider.cpp @@ -51,16 +51,15 @@ QmlBundle BasicBundleProvider::defaultBundle(const QString &bundleInfoName) { static bool wroteErrors = false; QmlBundle res; - QString defaultBundlePath = Core::ICore::resourcePath() - + QLatin1String("/qml-type-descriptions/") - + bundleInfoName; - if (!QFileInfo::exists(defaultBundlePath)) { + const Utils::FilePath defaultBundlePath = Core::ICore::resourcePath() / "qml-type-descriptions" + / bundleInfoName; + if (!defaultBundlePath.exists()) { qWarning() << "BasicBundleProvider: ERROR " << defaultBundlePath << " not found"; return res; } QStringList errors; - if (!res.readFrom(defaultBundlePath, &errors) && ! wroteErrors) { + if (!res.readFrom(defaultBundlePath.toString(), &errors) && !wroteErrors) { qWarning() << "BasicBundleProvider: ERROR reading " << defaultBundlePath << " : " << errors; wroteErrors = true; diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index c41d55b996..32db0688ca 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -220,15 +220,15 @@ void ModelManager::delayedInitialization() ViewerContext qbsVContext; qbsVContext.language = Dialect::QmlQbs; - qbsVContext.paths.append(ICore::resourcePath() + QLatin1String("/qbs")); + qbsVContext.paths.append(ICore::resourcePath().pathAppended("qbs").toString()); setDefaultVContext(qbsVContext); } void ModelManager::loadDefaultQmlTypeDescriptions() { if (ICore::instance()) { - loadQmlTypeDescriptionsInternal(ICore::resourcePath()); - loadQmlTypeDescriptionsInternal(ICore::userResourcePath()); + loadQmlTypeDescriptionsInternal(ICore::resourcePath().toString()); + loadQmlTypeDescriptionsInternal(ICore::userResourcePath().toString()); } } diff --git a/src/plugins/qmljstools/qmljstools_test.cpp b/src/plugins/qmljstools/qmljstools_test.cpp index a2c35efa00..51dd3dc8ef 100644 --- a/src/plugins/qmljstools/qmljstools_test.cpp +++ b/src/plugins/qmljstools/qmljstools_test.cpp @@ -43,7 +43,10 @@ void QmlJSToolsPlugin::test_basic() { 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->test_joinAllThreads(); diff --git a/src/plugins/qnx/qnxconfigurationmanager.cpp b/src/plugins/qnx/qnxconfigurationmanager.cpp index a6046c4120..04501be01c 100644 --- a/src/plugins/qnx/qnxconfigurationmanager.cpp +++ b/src/plugins/qnx/qnxconfigurationmanager.cpp @@ -40,7 +40,7 @@ const QLatin1String QNXConfigsFileVersionKey("Version"); static FilePath qnxConfigSettingsFileName() { - return FilePath::fromString(Core::ICore::userResourcePath() + "/qnx/qnxconfigurations.xml"); + return Core::ICore::userResourcePath() / "qnx/qnxconfigurations.xml"; } static QnxConfigurationManager *m_instance = nullptr; diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index a983752838..6753dc3ad8 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -449,7 +449,7 @@ void ExamplesListModel::parseTutorials(QXmlStreamReader *reader, const QString & static QString resourcePath() { // 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() diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index 8586ab89f1..54009c47ca 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -805,7 +805,7 @@ static QString qtVersionsFile(const QString &baseDir) 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); if (hasInstallSettings) *hasInstallSettings = installSettingsExist; @@ -834,7 +834,7 @@ static bool canLinkWithQt(QString *toolTip) &installSettingsExist); QStringList tip; tip << linkingPurposeText(); - if (!FilePath::fromString(Core::ICore::resourcePath()).isWritablePath()) { + if (!Core::ICore::resourcePath().isWritablePath()) { canLink = false; tip << QtOptionsPageWidget::tr("%1's resource directory is not writable.") .arg(Core::Constants::IDE_DISPLAY_NAME); @@ -997,7 +997,7 @@ void QtOptionsPageWidget::linkWithQt() unlinkButton->setEnabled(currentLink.has_value()); connect(unlinkButton, &QPushButton::clicked, &dialog, [&dialog, &askForRestart] { bool removeSettingsFile = false; - const QString filePath = settingsFile(Core::ICore::resourcePath()); + const QString filePath = settingsFile(Core::ICore::resourcePath().toString()); { QSettings installSettings(filePath, QSettings::IniFormat); installSettings.remove(kInstallSettingsKey); @@ -1016,7 +1016,7 @@ void QtOptionsPageWidget::linkWithQt() if (dialog.result() == QDialog::Accepted) { const Utils::optional<QString> settingsDir = settingsDirForQtDir(pathInput->rawPath()); if (QTC_GUARD(settingsDir)) { - QSettings(settingsFile(Core::ICore::resourcePath()), QSettings::IniFormat) + QSettings(settingsFile(Core::ICore::resourcePath().toString()), QSettings::IniFormat) .setValue(kInstallSettingsKey, *settingsDir); askForRestart = true; } diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index d362e53020..3c95dde01a 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -65,7 +65,7 @@ using namespace Internal; const char QTVERSION_DATA_KEY[] = "QtVersion."; const char QTVERSION_TYPE_KEY[] = "QtVersion.Type"; const char QTVERSION_FILE_VERSION_KEY[] = "Version"; -const char QTVERSION_FILENAME[] = "/qtversion.xml"; +const char QTVERSION_FILENAME[] = "qtversion.xml"; using VersionMap = QMap<int, BaseQtVersion *>; static VersionMap m_versions; @@ -84,12 +84,12 @@ static Q_LOGGING_CATEGORY(log, "qtc.qt.versions", QtWarningMsg); static FilePath globalSettingsFileName() { - return FilePath::fromString(Core::ICore::installerResourcePath() + QTVERSION_FILENAME); + return Core::ICore::installerResourcePath() / QTVERSION_FILENAME; } static FilePath settingsFileName(const QString &path) { - return FilePath::fromString(Core::ICore::userResourcePath() + path); + return Core::ICore::userResourcePath() / path; } diff --git a/src/plugins/studiowelcome/examplecheckout.cpp b/src/plugins/studiowelcome/examplecheckout.cpp index c7180155d8..7d31cfc40f 100644 --- a/src/plugins/studiowelcome/examplecheckout.cpp +++ b/src/plugins/studiowelcome/examplecheckout.cpp @@ -65,8 +65,10 @@ void ExampleCheckout::checkoutExample(const QUrl &url) layout->addWidget(widget); widget->engine()->addImportPath("qrc:/studiofonts"); - widget->engine()->addImportPath(Core::ICore::resourcePath() - + "/qmldesigner/propertyEditorQmlSources/imports"); + widget->engine()->addImportPath( + Core::ICore::resourcePath() + .pathAppended("/qmldesigner/propertyEditorQmlSources/imports") + .toString()); widget->setSource(QUrl("qrc:/qml/downloaddialog/main.qml")); diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 0129b0e226..2f337bf25f 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -207,14 +207,14 @@ public: return; } - const QString projectFile = Core::ICore::resourcePath() + "/examples/" + example + "/" - + example + ".qmlproject"; - - ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile); - const QString qmlFile = Core::ICore::resourcePath() + "/examples/" + example + "/" - + formFile; - - Core::EditorManager::openEditor(qmlFile); + const Utils::FilePath projectFile = Core::ICore::resourcePath() / "examples" / example + / example + + ".qmlproject"; + ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile.toString()); + const Utils::FilePath qmlFile = Core::ICore::resourcePath() / "examples" / example + / formFile; + + Core::EditorManager::openEditor(qmlFile.toString()); } public slots: void resetProjects(); diff --git a/src/plugins/texteditor/codestylepool.cpp b/src/plugins/texteditor/codestylepool.cpp index 55377eceae..272f6772c6 100644 --- a/src/plugins/texteditor/codestylepool.cpp +++ b/src/plugins/texteditor/codestylepool.cpp @@ -94,9 +94,7 @@ QByteArray CodeStylePoolPrivate::generateUniqueId(const QByteArray &id) const static QString customCodeStylesPath() { - QString path = Core::ICore::userResourcePath(); - path.append(QLatin1String("/codestyles/")); - return path; + return Core::ICore::userResourcePath().pathAppended("codestyles").toString(); } CodeStylePool::CodeStylePool(ICodeStylePreferencesFactory *factory, QObject *parent) diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index d74a13b2cc..4e61f89ebc 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -504,20 +504,19 @@ int FontSettings::defaultFontSize() */ QString FontSettings::defaultSchemeFileName(const QString &fileName) { - QString defaultScheme = Core::ICore::resourcePath(); - defaultScheme += QLatin1String("/styles/"); + Utils::FilePath defaultScheme = Core::ICore::resourcePath() / "styles"; - if (!fileName.isEmpty() && QFile::exists(defaultScheme + fileName)) { - defaultScheme += fileName; + if (!fileName.isEmpty() && (defaultScheme / fileName).exists()) { + defaultScheme = defaultScheme / fileName; } else { const QString themeScheme = Utils::creatorTheme()->defaultTextEditorColorScheme(); - if (!themeScheme.isEmpty() && QFile::exists(defaultScheme + themeScheme)) - defaultScheme += themeScheme; + if (!themeScheme.isEmpty() && (defaultScheme / themeScheme).exists()) + defaultScheme = defaultScheme / themeScheme; else - defaultScheme += QLatin1String("default.xml"); + defaultScheme = defaultScheme / "default.xml"; } - return defaultScheme; + return defaultScheme.toString(); } } // namespace TextEditor diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 42c14549c4..19759d2208 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -191,9 +191,7 @@ public: static QString customStylesPath() { - QString path = Core::ICore::userResourcePath(); - path.append(QLatin1String("/styles/")); - return path; + return Core::ICore::userResourcePath().pathAppended("styles").toString(); } static QString createColorSchemeFileName(const QString &pattern) @@ -558,8 +556,7 @@ void FontSettingsPageWidget::refreshColorSchemeList() { QList<ColorSchemeEntry> colorSchemes; - QString resourcePath = Core::ICore::resourcePath(); - QDir styleDir(resourcePath + QLatin1String("/styles")); + QDir styleDir(Core::ICore::resourcePath().pathAppended("styles").toDir()); styleDir.setNameFilters(QStringList() << QLatin1String("*.xml")); styleDir.setFilter(QDir::Files); diff --git a/src/plugins/texteditor/highlighter.cpp b/src/plugins/texteditor/highlighter.cpp index 51e1a307f1..5e770078b2 100644 --- a/src/plugins/texteditor/highlighter.cpp +++ b/src/plugins/texteditor/highlighter.cpp @@ -59,7 +59,7 @@ KSyntaxHighlighting::Repository *highlightRepository() if (!repository) { repository = new KSyntaxHighlighting::Repository(); 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()) repository->addCustomSearchPath(dir.path()); } diff --git a/src/plugins/texteditor/highlightersettings.cpp b/src/plugins/texteditor/highlightersettings.cpp index bb224f6345..9edb522a57 100644 --- a/src/plugins/texteditor/highlightersettings.cpp +++ b/src/plugins/texteditor/highlightersettings.cpp @@ -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()) return dir.path(); @@ -165,8 +165,8 @@ void HighlighterSettings::assignDefaultIgnoredPatterns() void HighlighterSettings::assignDefaultDefinitionsPath() { - const QString &path = - Core::ICore::userResourcePath() + QLatin1String("/generic-highlighter"); + const QString path + = Core::ICore::userResourcePath().pathAppended("generic-highlighter").toString(); if (QFile::exists(path) || QDir().mkpath(path)) m_definitionFilesPath = path; } diff --git a/src/plugins/texteditor/snippets/snippetscollection.cpp b/src/plugins/texteditor/snippets/snippetscollection.cpp index afb6c28eda..bdde6f4c2c 100644 --- a/src/plugins/texteditor/snippets/snippetscollection.cpp +++ b/src/plugins/texteditor/snippets/snippetscollection.cpp @@ -94,11 +94,11 @@ SnippetsCollection *SnippetsCollection::instance() } // SnippetsCollection -SnippetsCollection::SnippetsCollection() : - m_userSnippetsPath(Core::ICore::userResourcePath() + QLatin1String("/snippets/")), - m_userSnippetsFile(QLatin1String("snippets.xml")) +SnippetsCollection::SnippetsCollection() + : m_userSnippetsPath(Core::ICore::userResourcePath().pathAppended("snippets/").toString()) + , 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"))); foreach (const QFileInfo &fi, dir.entryInfoList()) m_builtInSnippetsFiles.append(fi.absoluteFilePath()); |