Update windows launch on start binary location
authorHannah von Reth <hannah.vonreth@owncloud.com>
Tue, 15 Dec 2020 14:02:33 +0000 (15:02 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Wed, 30 Dec 2020 15:17:47 +0000 (16:17 +0100)
Fixes: #7672
src/common/utility_win.cpp
src/gui/generalsettings.cpp

index 8a56bcd4198d7563352cb9bdbb5410ed94794c55..c6f9c00667c2e45d45f2acae0a4710b8a4d0dd38 100644 (file)
@@ -94,7 +94,7 @@ void setLaunchOnStartup_private(const QString &appName, const QString &guiName,
     QString runPath = QLatin1String(runPathC);
     QSettings settings(runPath, QSettings::NativeFormat);
     if (enable) {
-        settings.setValue(appName, QCoreApplication::applicationFilePath().replace(QLatin1Char('/'), QLatin1Char('\\')));
+        settings.setValue(appName, QDir::toNativeSeparators(QCoreApplication::applicationFilePath()));
     } else {
         settings.remove(appName);
     }
index 1e87d7ae6f7d0f20fb8e9d91d0ae8309ff52fc94..0f4c21f5286caf366a43975a91f1cbd545f4b44d 100644 (file)
@@ -161,7 +161,10 @@ GeneralSettings::GeneralSettings(QWidget *parent)
         _ui->autostartCheckBox->setDisabled(true);
         _ui->autostartCheckBox->setToolTip(tr("You cannot disable autostart because system-wide autostart is enabled."));
     } else {
-        _ui->autostartCheckBox->setChecked(Utility::hasLaunchOnStartup(Theme::instance()->appName()));
+        const bool hasAutoStart = Utility::hasLaunchOnStartup(Theme::instance()->appName());
+        // make sure the binary location is correctly set
+        slotToggleLaunchOnStartup(hasAutoStart);
+        _ui->autostartCheckBox->setChecked(hasAutoStart);
         connect(_ui->autostartCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotToggleLaunchOnStartup);
     }