Skip to content

Commit aea9d20

Browse files
committed
Qt: Use QCoreApplication::application*Path instead of inspecting argv to determine exe path
1 parent 54e50bd commit aea9d20

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/platform/qt/ApplicationUpdater.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ ApplicationUpdater::ApplicationUpdater(ConfigController* config, QObject* parent
5353
});
5454

5555
connect(this, &AbstractUpdater::updateDone, this, [this, config]() {
56-
QByteArray arg0 = GBAApp::app()->arguments().at(0).toUtf8();
56+
QByteArray exe = GBAApp::applicationFilePath().toUtf8();
5757
QByteArray path = updateInfo().url.path().toUtf8();
58-
mUpdateRegister(config->config(), arg0.constData(), path.constData());
58+
mUpdateRegister(config->config(), exe.constData(), path.constData());
5959
config->write();
6060
});
6161
}
@@ -153,8 +153,8 @@ QString ApplicationUpdater::destination() const {
153153

154154
const char* ApplicationUpdater::platform() {
155155
#ifdef Q_OS_WIN
156-
QFileInfo exe(GBAApp::app()->arguments().at(0));
157-
QFileInfo uninstallInfo(exe.dir().filePath("unins000.dat"));
156+
QDir appdir(QCoreApplication::applicationDirPath());
157+
QFileInfo uninstallInfo(appdir.filePath("unins000.dat"));
158158
#ifdef Q_OS_WIN64
159159
return uninstallInfo.exists() ? "win64-installer" : "win64";
160160
#elif defined(Q_OS_WIN32)

0 commit comments

Comments
 (0)