diff options
author | Eike Ziller <eike.ziller@qt.io> | 2021-02-12 15:36:07 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2021-02-15 08:30:47 +0000 |
commit | 2197eeb4aa8d7a44c444e3646138c69559c9176e (patch) | |
tree | 48406dfd9b36fad28aecdcd55a5826a6afa1152f | |
parent | 6009673a2d17aff98b428f969a6b4bfaec7e9213 (diff) |
Fix installation directory in plugin install wizard
Correctly initialize the bool variable that decides where the plugin is
installed.
Fix creation of installation directory: QDir::cdUp does not do anything
for directories that do not exist.
Change-Id: I5ee559a663380f293046eded7a2c3efbb1023776
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
-rw-r--r-- | src/libs/utils/fileutils.h | 5 | ||||
-rw-r--r-- | src/plugins/coreplugin/plugininstallwizard.cpp | 5 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h index 5db3a0a1c28..81d204ea7d0 100644 --- a/src/libs/utils/fileutils.h +++ b/src/libs/utils/fileutils.h @@ -211,9 +211,8 @@ bool FileUtils::copyRecursively(const FilePath &srcFilePath, const QFileInfo srcFileInfo = srcFilePath.toFileInfo(); if (srcFileInfo.isDir()) { if (!tgtFilePath.exists()) { - QDir targetDir(tgtFilePath.toString()); - targetDir.cdUp(); - if (!targetDir.mkdir(tgtFilePath.fileName())) { + const QDir targetDir(tgtFilePath.parentDir().toString()); + if (!targetDir.mkpath(tgtFilePath.fileName())) { if (error) { *error = QCoreApplication::translate("Utils::FileUtils", "Failed to create directory \"%1\".") diff --git a/src/plugins/coreplugin/plugininstallwizard.cpp b/src/plugins/coreplugin/plugininstallwizard.cpp index c91629e5aaf..e2bc69fb41b 100644 --- a/src/plugins/coreplugin/plugininstallwizard.cpp +++ b/src/plugins/coreplugin/plugininstallwizard.cpp @@ -63,7 +63,7 @@ struct Data { FilePath sourcePath; FilePath extractedPath; - bool installIntoApplication; + bool installIntoApplication = false; }; static QStringList libraryNameFilter() @@ -353,7 +353,7 @@ public: vlayout->addSpacing(10); auto localInstall = new QRadioButton(PluginInstallWizard::tr("User plugins")); - localInstall->setChecked(true); + localInstall->setChecked(!m_data->installIntoApplication); auto localLabel = new QLabel( PluginInstallWizard::tr("The plugin will be available to all compatible %1 " "installations, but only for the current user.") @@ -367,6 +367,7 @@ public: auto appInstall = new QRadioButton( PluginInstallWizard::tr("%1 installation").arg(Constants::IDE_DISPLAY_NAME)); + appInstall->setChecked(m_data->installIntoApplication); auto appLabel = new QLabel( PluginInstallWizard::tr("The plugin will be available only to this %1 " "installation, but for all users that can access it.") |