From 52cefc693e61042f45a7959059cc10a6ae82a936 Mon Sep 17 00:00:00 2001 From: jolavillette Date: Fri, 4 Sep 2026 07:53:07 +0200 Subject: [PATCH] gui/main: fix Linux/macOS build, applicationFilePath was declared under WINDOWS_SYS only Commit e63584843 declared applicationFilePath inside the WINDOWS_SYS block but uses it unconditionally to fill conf.main_executable_path, so every non-Windows GUI build fails with 'applicationFilePath was not declared in this scope'. Declare it at function scope, seeded from argv[0] (the previous non-Windows behaviour); Windows still overrides it with QCoreApplication::applicationFilePath(). Co-Authored-By: Claude Fable 5 --- retroshare-gui/src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index fa90de2a7..d4d6c84f9 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -299,6 +299,9 @@ QString filedialog_existing_directory_hook(QWidget *parent, const QString &capti int main(int argc, char *argv[]) { + /* On Windows argv[0] does not always contain the full path, so the real + one is fetched below through QCoreApplication::applicationFilePath(). */ + QString applicationFilePath = QString::fromLocal8Bit(argv[0]); #ifdef WINDOWS_SYS // The current directory of the application is changed when using the native dialog on Windows // This is a quick fix until libretroshare is using a absolute path in the portable Version @@ -326,7 +329,6 @@ 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 */