Core: Add a default parameter to various ICore::*path functions

Saves some code on the user side.

Change-Id: I32cd220b6e533f5497a1865f9c34ab9db4cfda79
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2021-04-26 15:46:09 +02:00
parent c236a25339
commit 8e352af0ec
70 changed files with 142 additions and 150 deletions

View File

@@ -142,7 +142,7 @@ namespace {
static QString sdkSettingsFileName()
{
return Core::ICore::installerResourcePath().pathAppended("android.xml").toString();
return Core::ICore::installerResourcePath("android.xml").toString();
}
static bool is32BitUserSpace()
@@ -270,8 +270,8 @@ void AndroidConfig::save(QSettings &settings) const
void AndroidConfig::parseDependenciesJson()
{
FilePath sdkConfigUserFile(Core::ICore::userResourcePath() / JsonFilePath);
FilePath sdkConfigFile(Core::ICore::resourcePath() / JsonFilePath);
const FilePath sdkConfigUserFile = Core::ICore::userResourcePath(JsonFilePath);
const FilePath sdkConfigFile = Core::ICore::resourcePath(JsonFilePath);
if (!sdkConfigUserFile.exists()) {
QDir(sdkConfigUserFile.toFileInfo().absolutePath()).mkpath(".");

View File

@@ -61,7 +61,7 @@ static DebugServerProviderManager *m_instance = nullptr;
// DebugServerProviderManager
DebugServerProviderManager::DebugServerProviderManager()
: m_configFile(Core::ICore::userResourcePath() / fileNameKeyC)
: m_configFile(Core::ICore::userResourcePath(fileNameKeyC))
, m_factories({new GenericGdbServerProviderFactory,
new JLinkGdbServerProviderFactory,
new OpenOcdGdbServerProviderFactory,

View File

@@ -49,8 +49,7 @@ const char SUPPORTED_MIME[] = "supportedMime";
AbstractSettings::AbstractSettings(const QString &name, const QString &ending)
: m_ending(ending)
, m_styleDir(Core::ICore::userResourcePath()
.pathAppended(Beautifier::Constants::SETTINGS_DIRNAME)
, m_styleDir(Core::ICore::userResourcePath(Beautifier::Constants::SETTINGS_DIRNAME)
.pathAppended(name)
.toString())
, m_name(name)

View File

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

View File

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

View File

@@ -173,7 +173,7 @@ void ClangFormatConfigWidget::initChecksAndPreview()
connect(m_ui->applyButton, &QPushButton::clicked, this, &ClangFormatConfigWidget::apply);
fileName = m_project->projectFilePath().pathAppended("snippet.cpp");
} else {
fileName = Core::ICore::userResourcePath() / "snippet.cpp";
fileName = Core::ICore::userResourcePath("snippet.cpp");
}
m_preview->textDocument()->indenter()->setFileName(fileName);
}

View File

@@ -55,7 +55,7 @@ ClangPchManager::PchManagerConnectionClient::PchManagerConnectionClient(
pchsDirectory.mkdir("pchs");
pchsDirectory.cd("pchs");
m_processCreator.setArguments({connectionName(),
Core::ICore::cacheResourcePath() + "/symbol-experimental-v1.db",
Core::ICore::cacheResourcePath("symbol-experimental-v1.db"),
pchsDirectory.absolutePath(),
Core::ICore::resourcePath()});

View File

@@ -49,8 +49,8 @@ RefactoringConnectionClient::RefactoringConnectionClient(RefactoringClientInterf
{
m_processCreator.setTemporaryDirectoryPattern("clangrefactoringbackend-XXXXXX");
m_processCreator.setArguments({connectionName(),
Core::ICore::cacheResourcePath() + "/symbol-experimental-v1.db",
Core::ICore::resourcePath()});
Core::ICore::cacheResourcePath("symbol-experimental-v1.db").toString(),
Core::ICore::resourcePath().toString()});
stdErrPrefixer().setPrefix("RefactoringConnectionClient.stderr: ");
stdOutPrefixer().setPrefix("RefactoringConnectionClient.stdout: ");

View File

@@ -836,7 +836,7 @@ void CMakeGeneratorKitAspect::addToEnvironment(const Kit *k, Utils::Environment
if (env.searchInPath("jom.exe").exists())
return;
env.appendOrSetPath(Core::ICore::libexecPath().toUserOutput());
env.appendOrSetPath(Core::ICore::libexecPath().pathAppended("jom").toUserOutput());
env.appendOrSetPath(Core::ICore::libexecPath("jom").toUserOutput());
}
}

View File

@@ -164,7 +164,7 @@ CMakeToolSettingsAccessor::CMakeToolSettingsAccessor() :
QCoreApplication::translate("CMakeProjectManager::CMakeToolManager", "CMake"),
Core::Constants::IDE_DISPLAY_NAME)
{
setBaseFilePath(Core::ICore::userResourcePath() / CMAKE_TOOL_FILENAME);
setBaseFilePath(Core::ICore::userResourcePath(CMAKE_TOOL_FILENAME));
addVersionUpgrader(std::make_unique<CMakeToolSettingsUpgraderV0>());
}
@@ -173,7 +173,7 @@ CMakeToolSettingsAccessor::CMakeTools CMakeToolSettingsAccessor::restoreCMakeToo
{
CMakeTools result;
const FilePath sdkSettingsFile = Core::ICore::installerResourcePath() / CMAKE_TOOL_FILENAME;
const FilePath sdkSettingsFile = Core::ICore::installerResourcePath(CMAKE_TOOL_FILENAME);
CMakeTools sdkTools = cmakeTools(restoreSettings(sdkSettingsFile, parent), true);

View File

@@ -637,7 +637,7 @@ static QString getUserFilePath(const QString &proposalFileName)
resourceDir.mkpath(QLatin1String("externaltools"));
const QFileInfo fi(proposalFileName);
const QString &suffix = QLatin1Char('.') + fi.completeSuffix();
const FilePath newFilePath = ICore::userResourcePath() / "externaltools" / fi.baseName();
const FilePath newFilePath = ICore::userResourcePath("externaltools") / fi.baseName();
int count = 0;
FilePath tryPath = newFilePath + suffix;
while (tryPath.exists()) {

View File

@@ -52,6 +52,9 @@ using namespace Utils;
Q_DECLARE_METATYPE(Core::Internal::ShortcutItem*)
namespace Core {
namespace Internal {
const char kSeparator[] = " | ";
static int translateModifiers(Qt::KeyboardModifiers state,
@@ -147,12 +150,9 @@ static bool isTextKeySequence(const QKeySequence &sequence)
static FilePath schemesPath()
{
return Core::ICore::resourcePath() / "schemes";
return Core::ICore::resourcePath("schemes");
}
namespace Core {
namespace Internal {
ShortcutButton::ShortcutButton(QWidget *parent)
: QPushButton(parent)
, m_key({{0, 0, 0, 0}})

View File

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

View File

@@ -132,7 +132,7 @@ void GeneralSettingsWidget::fillLanguageBox() const
if (currentLocale == QLatin1String("C"))
m_ui.languageBox->setCurrentIndex(m_ui.languageBox->count() - 1);
const FilePath creatorTrPath = ICore::resourcePath() / "translations";
const FilePath creatorTrPath = ICore::resourcePath("translations");
const QStringList languageFiles = creatorTrPath.toDir().entryList(
QStringList(QLatin1String("qtcreator*.qm")));

View File

@@ -386,6 +386,14 @@ QString ICore::userInterfaceLanguage()
return qApp->property("qtc_locale").toString();
}
static QString pathHelper(const QString &rel)
{
if (rel.isEmpty())
return rel;
if (rel.startsWith('/'))
return rel;
return '/' + rel;
}
/*!
Returns the absolute path that is used for resources like
project templates and the debugger macros.
@@ -396,10 +404,11 @@ QString ICore::userInterfaceLanguage()
\sa userResourcePath()
*/
FilePath ICore::resourcePath()
FilePath ICore::resourcePath(const QString &rel)
{
return FilePath::fromString(
QDir::cleanPath(QCoreApplication::applicationDirPath() + '/' + RELATIVE_DATA_PATH));
QDir::cleanPath(QCoreApplication::applicationDirPath() + '/' + RELATIVE_DATA_PATH +
pathHelper(rel)));
}
/*!
@@ -412,7 +421,7 @@ FilePath ICore::resourcePath()
\sa resourcePath()
*/
FilePath ICore::userResourcePath()
FilePath ICore::userResourcePath(const QString &rel)
{
// Create qtcreator dir if it doesn't yet exist
const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path();
@@ -424,25 +433,26 @@ FilePath ICore::userResourcePath()
qWarning() << "could not create" << urp;
}
return FilePath::fromString(urp);
return FilePath::fromString(urp + pathHelper(rel));
}
/*!
Returns a writable path that can be used for persistent cache files.
*/
FilePath ICore::cacheResourcePath()
FilePath ICore::cacheResourcePath(const QString &rel)
{
return FilePath::fromString(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
return FilePath::fromString(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)
+ pathHelper(rel));
}
/*!
Returns the path to resources written by the installer, for example
pre-defined kits and toolchains.
*/
FilePath ICore::installerResourcePath()
FilePath ICore::installerResourcePath(const QString &rel)
{
return FilePath::fromString(settings(QSettings::SystemScope)->fileName()).parentDir()
/ Constants::IDE_ID;
/ Constants::IDE_ID / rel;
}
/*!
@@ -478,18 +488,18 @@ QString ICore::userPluginPath()
Returns the path to the command line tools that are included in the \QC
installation.
*/
FilePath ICore::libexecPath()
FilePath ICore::libexecPath(const QString &rel)
{
return FilePath::fromString(
QDir::cleanPath(QApplication::applicationDirPath() + RELATIVE_LIBEXEC_PATH));
QDir::cleanPath(QApplication::applicationDirPath() + RELATIVE_LIBEXEC_PATH + pathHelper(rel)));
}
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()
@@ -508,7 +518,7 @@ static QString clangIncludePath(const QString &clangVersion)
QString ICore::clangIncludeDirectory(const QString &clangVersion,
const QString &clangFallbackIncludeDir)
{
FilePath dir = libexecPath() / "clang" + clangIncludePath(clangVersion);
FilePath dir = libexecPath("clang" + clangIncludePath(clangVersion));
if (!dir.exists() || !dir.pathAppended("stdint.h").exists())
dir = FilePath::fromString(clangFallbackIncludeDir);
return dir.canonicalPath().toUserOutput();
@@ -520,7 +530,7 @@ QString ICore::clangIncludeDirectory(const QString &clangVersion,
static QString clangBinary(const QString &binaryBaseName, const QString &clangBinDirectory)
{
const QString hostExeSuffix(QTC_HOST_EXE_SUFFIX);
FilePath executable = ICore::libexecPath() / "clang/bin" / binaryBaseName + hostExeSuffix;
FilePath executable = ICore::libexecPath("clang/bin") / binaryBaseName + hostExeSuffix;
if (!executable.exists())
executable = FilePath::fromString(clangBinDirectory) / binaryBaseName + hostExeSuffix;
return executable.canonicalPath().toUserOutput();

View File

@@ -95,11 +95,11 @@ public:
static QPrinter *printer();
static QString userInterfaceLanguage();
static Utils::FilePath resourcePath();
static Utils::FilePath userResourcePath();
static Utils::FilePath cacheResourcePath();
static Utils::FilePath installerResourcePath();
static Utils::FilePath libexecPath();
static Utils::FilePath resourcePath(const QString &rel = {});
static Utils::FilePath userResourcePath(const QString &rel = {});
static Utils::FilePath cacheResourcePath(const QString &rel = {});
static Utils::FilePath installerResourcePath(const QString &rel = {});
static Utils::FilePath libexecPath(const QString &rel = {});
static Utils::FilePath crashReportsPath();
static QString ideDisplayName();

View File

@@ -53,7 +53,7 @@
#include <QStyledItemDelegate>
#include <QSortFilterProxyModel>
static const char kModifiedMimeTypesFile[] = "/mimetypes/modifiedmimetypes.xml";
static const char kModifiedMimeTypesFile[] = "mimetypes/modifiedmimetypes.xml";
static const char mimeInfoTagC[] = "mime-info";
static const char mimeTypeTagC[] = "mime-type";
@@ -564,8 +564,7 @@ static QPair<int, int> rangeFromString(const QString &offset)
MimeTypeSettingsPrivate::UserMimeTypeHash MimeTypeSettingsPrivate::readUserModifiedMimeTypes()
{
static Utils::FilePath modifiedMimeTypesPath = ICore::userResourcePath()
+ kModifiedMimeTypesFile;
static Utils::FilePath modifiedMimeTypesPath = ICore::userResourcePath(kModifiedMimeTypesFile);
UserMimeTypeHash userMimeTypes;
QFile file(modifiedMimeTypesPath.toString());
if (file.open(QFile::ReadOnly)) {

View File

@@ -211,8 +211,8 @@ QList<ThemeEntry> ThemeEntry::availableThemes()
{
QList<ThemeEntry> themes;
static const FilePath installThemeDir = ICore::resourcePath() + QLatin1String("/themes");
static const FilePath userThemeDir = ICore::userResourcePath() + QLatin1String("/themes");
static const FilePath installThemeDir = ICore::resourcePath("themes");
static const FilePath userThemeDir = ICore::userResourcePath("themes");
addThemesFromPath(installThemeDir.toString(), &themes);
if (themes.isEmpty())
qWarning() << "Warning: No themes found in installation: "

View File

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

View File

@@ -835,7 +835,7 @@ void DebuggerItemManagerPrivate::autoDetectUvscDebuggers()
static FilePath userSettingsFileName()
{
return 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(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().pathAppended("debugger/").toString();
const QString dumperSourcePath = ICore::resourcePath("debugger/").toString();
//if (terminal()->isUsable())
// runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice())});

View File

@@ -232,8 +232,7 @@ void LldbEngine::setupEngine()
showStatusMessage(tr("Setting up inferior..."));
const QByteArray dumperSourcePath = ICore::resourcePath().toString().toLocal8Bit()
+ "/debugger/";
const QByteArray dumperSourcePath = ICore::resourcePath("debugger/").toString().toLocal8Bit();
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().pathAppended("debugger/pdbbridge.py").toString();
QString bridge = ICore::resourcePath("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,7 +106,7 @@ 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().pathAppended("translations").toString();
const QString creatorTrPath = ICore::resourcePath("translations").toString();
const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString trFile = "designer_" + locale;
if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath))

View File

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

View File

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

View File

@@ -193,7 +193,7 @@ HelpPluginPrivate::HelpPluginPrivate()
if (!locale.isEmpty()) {
auto qtr = new QTranslator(this);
auto qhelptr = new QTranslator(this);
const QString creatorTrPath = ICore::resourcePath().pathAppended("translations").toString();
const QString creatorTrPath = ICore::resourcePath("translations").toString();
const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString trFile = QLatin1String("assistant_") + locale;
const QString helpTrFile = QLatin1String("qt_help_") + locale;

View File

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

View File

@@ -386,7 +386,7 @@ void MacroManager::saveLastMacro()
QString MacroManager::macrosDirectory()
{
const QString path = Core::ICore::userResourcePath().pathAppended("macros").toString();
const QString path = Core::ICore::userResourcePath("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(Core::ICore::libexecPath().pathAppended("clang/bin").toUserOutput());
pathAdditions.append(Core::ICore::libexecPath("clang/bin").toUserOutput());
changes.append({path, pathAdditions.join(HostOsInfo::pathListSeparator())});
}

View File

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

View File

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

View File

@@ -142,7 +142,7 @@ ExtDocumentController *ModelsManager::createModel(ModelDocument *modelDocument)
auto documentController = new ExtDocumentController(this);
// TODO error output on reading definition files
documentController->configController()->readStereotypeDefinitions(
Core::ICore::resourcePath().pathAppended("modeleditor").toString());
Core::ICore::resourcePath("modeleditor").toString());
d->managedModels.append(ManagedModel(documentController, modelDocument));
return documentController;

View File

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

View File

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

View File

@@ -141,19 +141,17 @@ void DeviceManager::load()
QTC_ASSERT(!d->writer, return);
// Only create writer now: We do not want to save before the settings were read!
d->writer = new Utils::PersistentSettingsWriter(
settingsFilePath(QLatin1String("/devices.xml")),
QLatin1String("QtCreatorDevices"));
d->writer = new PersistentSettingsWriter(settingsFilePath("devices.xml"), "QtCreatorDevices");
Utils::PersistentSettingsReader reader;
// read devices file from global settings path
QHash<Utils::Id, Utils::Id> defaultDevices;
QList<IDevice::Ptr> sdkDevices;
if (reader.load(systemSettingsFilePath(QLatin1String("/devices.xml"))))
if (reader.load(systemSettingsFilePath("devices.xml")))
sdkDevices = fromMap(reader.restoreValues().value(DeviceManagerKey).toMap(), &defaultDevices);
// read devices file from user settings path
QList<IDevice::Ptr> userDevices;
if (reader.load(settingsFilePath(QLatin1String("/devices.xml"))))
if (reader.load(settingsFilePath("devices.xml")))
userDevices = fromMap(reader.restoreValues().value(DeviceManagerKey).toMap(), &defaultDevices);
// Insert devices into the model. Prefer the higher device version when there are multiple
// devices with the same id.
@@ -223,14 +221,14 @@ QVariantMap DeviceManager::toMap() const
return map;
}
Utils::FilePath DeviceManager::settingsFilePath(const QString &extension)
FilePath DeviceManager::settingsFilePath(const QString &extension)
{
return Core::ICore::userResourcePath() + extension;
return Core::ICore::userResourcePath(extension);
}
Utils::FilePath DeviceManager::systemSettingsFilePath(const QString &deviceFileRelativePath)
FilePath DeviceManager::systemSettingsFilePath(const QString &deviceFileRelativePath)
{
return 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(Core::ICore::installerResourcePath() / "abi.xml");
setBaseFilePath(Core::ICore::installerResourcePath("abi.xml"));
addVersionUpgrader(std::make_unique<AbiFlavorUpgraderV0>());
}

View File

@@ -336,8 +336,8 @@ static QStringList environmentTemplatesPaths()
Utils::FilePaths &JsonWizardFactory::searchPaths()
{
static Utils::FilePaths m_searchPaths = {Core::ICore::userResourcePath() / WIZARD_PATH,
Core::ICore::resourcePath() / 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

@@ -83,7 +83,7 @@ const char KIT_FILENAME[] = "profiles.xml";
static FilePath settingsFileName()
{
return ICore::userResourcePath() / KIT_FILENAME;
return ICore::userResourcePath(KIT_FILENAME);
}
// --------------------------------------------------------------------------
@@ -197,7 +197,7 @@ void KitManager::restoreKits()
// read all kits from SDK
{
KitList system = restoreKitsHelper(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

@@ -1139,7 +1139,7 @@ FilePath MsvcToolChain::makeCommand(const Environment &environment) const
if (useJom) {
tmp = environment.searchInPath(jom,
{Core::ICore::libexecPath(),
Core::ICore::libexecPath().pathAppended("jom")});
Core::ICore::libexecPath("jom")});
if (!tmp.isEmpty())
command = tmp;
}

View File

@@ -788,7 +788,7 @@ QDateTime SessionManager::sessionDateTime(const QString &session)
FilePath SessionManager::sessionNameToFileName(const QString &session)
{
return ICore::userResourcePath() / session + ".qws";
return ICore::userResourcePath(session + ".qws");
}
/*!

View File

@@ -184,7 +184,7 @@ ToolChainSettingsAccessor::ToolChainSettingsAccessor() :
QCoreApplication::translate("ProjectExplorer::ToolChainManager", "Tool Chains"),
Core::Constants::IDE_DISPLAY_NAME)
{
setBaseFilePath(Core::ICore::userResourcePath() / TOOLCHAIN_FILENAME);
setBaseFilePath(Core::ICore::userResourcePath(TOOLCHAIN_FILENAME));
addVersionUpgrader(std::make_unique<ToolChainSettingsUpgraderV0>());
}
@@ -193,7 +193,7 @@ QList<ToolChain *> ToolChainSettingsAccessor::restoreToolChains(QWidget *parent)
{
// read all tool chains from SDK
const QList<ToolChain *> systemFileTcs = toolChains(
restoreSettings(Core::ICore::installerResourcePath() / TOOLCHAIN_FILENAME, parent));
restoreSettings(Core::ICore::installerResourcePath(TOOLCHAIN_FILENAME), parent));
for (ToolChain * const systemTc : systemFileTcs)
systemTc->setDetection(ToolChain::AutoDetectionFromSdk);

View File

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

View File

@@ -44,8 +44,8 @@ QmlDesignerIconProvider::QmlDesignerIconProvider()
static QString iconPath()
{
return Core::ICore::resourcePath()
.pathAppended("qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/images/")
return Core::ICore::resourcePath(
"qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/images/")
.toString();
}

View File

@@ -50,8 +50,7 @@ Theme::Theme(Utils::Theme *originTheme, QObject *parent)
, m_constants(nullptr)
{
QString constantsPath
= Core::ICore::resourcePath()
.pathAppended(
= Core::ICore::resourcePath(
"qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml")
.toString();

View File

@@ -66,7 +66,7 @@ class ImageCacheData
{
public:
Sqlite::Database database{Utils::PathString{
Core::ICore::cacheResourcePath().pathAppended("imagecache-v2.db").toString()}};
Core::ICore::cacheResourcePath("imagecache-v2.db").toString()}};
ImageCacheStorage<Sqlite::Database> storage{database};
ImageCacheConnectionManager connectionManager;
ImageCacheCollector collector{connectionManager};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -220,8 +220,8 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e
GenerateResource::generateMenuEntry();
const QString fontPath
= Core::ICore::resourcePath()
.pathAppended("qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf")
= Core::ICore::resourcePath(
"qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf")
.toString();
if (QFontDatabase::addApplicationFont(fontPath) < 0)
qCWarning(qmldesignerLog) << "Could not add font " << fontPath << "to font database";

View File

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

View File

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

View File

@@ -51,7 +51,7 @@ QmlBundle BasicBundleProvider::defaultBundle(const QString &bundleInfoName)
{
static bool wroteErrors = false;
QmlBundle res;
const Utils::FilePath defaultBundlePath = Core::ICore::resourcePath() / "qml-type-descriptions"
const Utils::FilePath defaultBundlePath = Core::ICore::resourcePath("qml-type-descriptions")
/ bundleInfoName;
if (!defaultBundlePath.exists()) {
qWarning() << "BasicBundleProvider: ERROR " << defaultBundlePath

View File

@@ -220,7 +220,7 @@ void ModelManager::delayedInitialization()
ViewerContext qbsVContext;
qbsVContext.language = Dialect::QmlQbs;
qbsVContext.paths.append(ICore::resourcePath().pathAppended("qbs").toString());
qbsVContext.paths.append(ICore::resourcePath("qbs").toString());
setDefaultVContext(qbsVContext);
}

View File

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

View File

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

View File

@@ -84,12 +84,12 @@ static Q_LOGGING_CATEGORY(log, "qtc.qt.versions", QtWarningMsg);
static FilePath globalSettingsFileName()
{
return Core::ICore::installerResourcePath() / QTVERSION_FILENAME;
return Core::ICore::installerResourcePath(QTVERSION_FILENAME);
}
static FilePath settingsFileName(const QString &path)
{
return Core::ICore::userResourcePath() / path;
return Core::ICore::userResourcePath(path);
}

View File

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

View File

@@ -207,12 +207,11 @@ public:
return;
}
const Utils::FilePath 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;
const Utils::FilePath qmlFile = Core::ICore::resourcePath("examples")
/ example / formFile;
Core::EditorManager::openEditor(qmlFile.toString());
}

View File

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

View File

@@ -504,7 +504,7 @@ int FontSettings::defaultFontSize()
*/
QString FontSettings::defaultSchemeFileName(const QString &fileName)
{
Utils::FilePath defaultScheme = Core::ICore::resourcePath() / "styles";
Utils::FilePath defaultScheme = Core::ICore::resourcePath("styles");
if (!fileName.isEmpty() && (defaultScheme / fileName).exists()) {
defaultScheme = defaultScheme / fileName;

View File

@@ -191,7 +191,7 @@ public:
static QString customStylesPath()
{
return Core::ICore::userResourcePath().pathAppended("styles").toString();
return Core::ICore::userResourcePath("styles").toString();
}
static QString createColorSchemeFileName(const QString &pattern)
@@ -556,7 +556,7 @@ void FontSettingsPageWidget::refreshColorSchemeList()
{
QList<ColorSchemeEntry> colorSchemes;
QDir styleDir(Core::ICore::resourcePath().pathAppended("styles").toDir());
QDir styleDir(Core::ICore::resourcePath("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().pathAppended("generic-highlighter/syntax").toDir());
QDir dir(Core::ICore::resourcePath("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().pathAppended("generic-highlighter").toString());
dir.setPath(Core::ICore::resourcePath("generic-highlighter").toString());
if (dir.exists() && !dir.entryInfoList().isEmpty())
return dir.path();
@@ -165,8 +165,7 @@ void HighlighterSettings::assignDefaultIgnoredPatterns()
void HighlighterSettings::assignDefaultDefinitionsPath()
{
const QString path
= Core::ICore::userResourcePath().pathAppended("generic-highlighter").toString();
const QString path = Core::ICore::userResourcePath("generic-highlighter").toString();
if (QFile::exists(path) || QDir().mkpath(path))
m_definitionFilesPath = path;
}

View File

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