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>
This commit is contained in:
Eike Ziller
2021-02-12 15:36:07 +01:00
parent 6009673a2d
commit 2197eeb4aa
2 changed files with 5 additions and 5 deletions

View File

@@ -211,9 +211,8 @@ bool FileUtils::copyRecursively(const FilePath &srcFilePath,
const QFileInfo srcFileInfo = srcFilePath.toFileInfo(); const QFileInfo srcFileInfo = srcFilePath.toFileInfo();
if (srcFileInfo.isDir()) { if (srcFileInfo.isDir()) {
if (!tgtFilePath.exists()) { if (!tgtFilePath.exists()) {
QDir targetDir(tgtFilePath.toString()); const QDir targetDir(tgtFilePath.parentDir().toString());
targetDir.cdUp(); if (!targetDir.mkpath(tgtFilePath.fileName())) {
if (!targetDir.mkdir(tgtFilePath.fileName())) {
if (error) { if (error) {
*error = QCoreApplication::translate("Utils::FileUtils", *error = QCoreApplication::translate("Utils::FileUtils",
"Failed to create directory \"%1\".") "Failed to create directory \"%1\".")

View File

@@ -63,7 +63,7 @@ struct Data
{ {
FilePath sourcePath; FilePath sourcePath;
FilePath extractedPath; FilePath extractedPath;
bool installIntoApplication; bool installIntoApplication = false;
}; };
static QStringList libraryNameFilter() static QStringList libraryNameFilter()
@@ -353,7 +353,7 @@ public:
vlayout->addSpacing(10); vlayout->addSpacing(10);
auto localInstall = new QRadioButton(PluginInstallWizard::tr("User plugins")); auto localInstall = new QRadioButton(PluginInstallWizard::tr("User plugins"));
localInstall->setChecked(true); localInstall->setChecked(!m_data->installIntoApplication);
auto localLabel = new QLabel( auto localLabel = new QLabel(
PluginInstallWizard::tr("The plugin will be available to all compatible %1 " PluginInstallWizard::tr("The plugin will be available to all compatible %1 "
"installations, but only for the current user.") "installations, but only for the current user.")
@@ -367,6 +367,7 @@ public:
auto appInstall = new QRadioButton( auto appInstall = new QRadioButton(
PluginInstallWizard::tr("%1 installation").arg(Constants::IDE_DISPLAY_NAME)); PluginInstallWizard::tr("%1 installation").arg(Constants::IDE_DISPLAY_NAME));
appInstall->setChecked(m_data->installIntoApplication);
auto appLabel = new QLabel( auto appLabel = new QLabel(
PluginInstallWizard::tr("The plugin will be available only to this %1 " PluginInstallWizard::tr("The plugin will be available only to this %1 "
"installation, but for all users that can access it.") "installation, but for all users that can access it.")