@@ -115,17 +115,9 @@ void migrateHomePath()
115115QString relativeInstallPath ()
116116{
117117 QFileInfo applicationFileInfo (QCoreApplication::applicationFilePath ());
118- QString applicationDirPath = applicationFileInfo.absolutePath ();
119- QString triggerFilePath = applicationDirPath + " /.relative-installation" ;
120- QFile triggerFile (triggerFilePath);
121- if (triggerFile.exists ()) {
122- if (!triggerFile.open (QIODevice::ReadOnly)) {
123- qFatal (" Cannot read %s" , qPrintable (triggerFilePath));
124- }
125- QTextStream content (&triggerFile);
126- if (content.readLine () == " 5930bb66-bd68-4f30-9bb1-dc760253d406" ) {
127- return applicationDirPath;
128- }
118+ if (applicationFileInfo.fileName ().toLower ().startsWith (" relative" ))
119+ {
120+ return applicationFileInfo.absolutePath ();
129121 }
130122 return QString ();
131123}
@@ -186,7 +178,17 @@ bool installShortcuts()
186178 qDebug () << " missing resource" << desktopFileName;
187179 return false ;
188180 }
189- QString desktopStr = QString (desktopFile.readAll ().data ()).arg (settings.installPath ());
181+
182+ QString name = " updater" ;
183+
184+ if (!relativeInstallPath ().isNull ()) {
185+ QFileInfo applicationFileInfo (QCoreApplication::applicationFilePath ());
186+ name = applicationFileInfo.fileName ();
187+ }
188+
189+ QString path = settings.installPath () + QDir::separator () + name;
190+
191+ QString desktopStr = QString (desktopFile.readAll ().data ()).arg (path);
190192 {
191193 QFile outputFile (desktopDir.filePath (desktopFileName));
192194 if (!outputFile.open (QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
@@ -222,7 +224,15 @@ bool installShortcuts()
222224
223225bool installUpdater (const QString& installPath) {
224226 QFileInfo src (QCoreApplication::applicationFilePath ());
225- QFileInfo dest (installPath + QDir::separator () + " updater" );
227+
228+ if (!relativeInstallPath ().isNull ())
229+ {
230+ qDebug () << " Updater is in relative install location" ;
231+ return true ;
232+ }
233+
234+ QFileInfo dest (installPath + QDir::separator () + " updater" );
235+
226236 if (src == dest) {
227237 qDebug () << " Updater already in install location" ;
228238 return true ;
@@ -322,7 +332,7 @@ QSettings* makePersistentSettings(QObject* parent)
322332 // the updater if there is already one there.
323333 QString relative = relativeInstallPath ();
324334 if (!relative.isNull ()) {
325- return new QSettings (relative + " / updater.conf" , QSettings::NativeFormat, parent);
335+ return new QSettings (relative + QDir::separator () + " updater.conf" , QSettings::NativeFormat, parent);
326336 }
327337
328338 // Standard installation, settings are stored
0 commit comments