Use “QCoreApplication::applicationFilePath” instead of argv[0] for the name of the executable file, as argv[0] does not always contain the full path on Windows

This commit is contained in:
thunder2 2026-07-26 01:27:40 +02:00
parent 086184ad21
commit e635848438

View File

@ -326,11 +326,13 @@ int main(int argc, char *argv[])
qt_use_native_dialogs = false;
#endif
QString applicationFilePath;
{
/* Set the current directory to the application dir,
because the start dir with autostart from the registry run key is not the exe dir */
QApplication app(argc, argv);
QDir::setCurrent(QCoreApplication::applicationDirPath());
applicationFilePath = QCoreApplication::applicationFilePath();
}
#endif
#ifdef SIGFPE_DEBUG
@ -427,7 +429,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
// Now start RS login system
conf.main_executable_path = argv[0];
conf.main_executable_path = applicationFilePath.toStdString();
int initResult = RsInit::InitRetroShare(conf);