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;
}
QDir FilePath::toDir() const
{
return QDir(m_data);
}
bool FilePath::operator==(const FilePath &other) const
{
if (!m_url.isEmpty())

View File

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

View File

@@ -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;

View File

@@ -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,

View File

@@ -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)
{
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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()

View File

@@ -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);

View File

@@ -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)."),

View File

@@ -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)

View File

@@ -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);

View File

@@ -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);

View File

@@ -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(')');

View File

@@ -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();
}
/*!

View File

@@ -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();

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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});

View File

@@ -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);

View File

@@ -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())});

View File

@@ -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":

View File

@@ -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),

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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)

View File

@@ -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))

View File

@@ -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()]];
}
}

View File

@@ -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) :

View File

@@ -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();

View File

@@ -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())});
}

View File

@@ -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()

View File

@@ -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,

View File

@@ -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;

View File

@@ -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));
}

View File

@@ -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)

View File

@@ -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)

View File

@@ -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>());
}

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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 &current : system.kits) {

View File

@@ -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();

View File

@@ -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";
}
/*!

View File

@@ -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);

View File

@@ -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()

View File

@@ -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()

View File

@@ -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)

View File

@@ -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));

View File

@@ -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};

View File

@@ -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()

View File

@@ -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

View File

@@ -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)

View File

@@ -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()

View File

@@ -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

View File

@@ -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()

View File

@@ -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

View File

@@ -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));

View File

@@ -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";

View File

@@ -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;

View File

@@ -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));
}

View File

@@ -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;

View File

@@ -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());
}
}

View File

@@ -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();

View File

@@ -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;

View File

@@ -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()

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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"));

View File

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

View File

@@ -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)

View File

@@ -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

View File

@@ -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);

View File

@@ -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());
}

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())
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;
}

View File

@@ -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());