From 5e952a561b948b9b150bc019cf56ae0e7b4b3992 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Wed, 25 Jan 2023 20:35:21 +0200 Subject: [PATCH 1/2] NSIS: Set shortcut's workind dir to install path --- dist/windows/installer.nsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/windows/installer.nsi b/dist/windows/installer.nsi index 75f2a0f95..95d002a6c 100644 --- a/dist/windows/installer.nsi +++ b/dist/windows/installer.nsi @@ -35,6 +35,8 @@ Section $(inst_qbt_req) ;"qBittorrent (required)" SetOutPath "$INSTDIR\translations" ; Put files there File /r "translations\qt*.qm" + ; Restore output path because it affects `CreateShortCut`. It affects the "Start in" field. + SetOutPath $INSTDIR ; Write the installation path into the registry WriteRegStr HKLM "Software\qBittorrent" "InstallLocation" "$INSTDIR" From b61c7b722045db4c15f1a1701451c5aa877e6fa6 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Wed, 25 Jan 2023 23:27:06 +0200 Subject: [PATCH 2/2] Adjust env variable for PDB discovery --- src/app/main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/main.cpp b/src/app/main.cpp index 69d91f739..bbb293479 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -118,6 +118,17 @@ int main(int argc, char *argv[]) // Create Application auto app = std::make_unique(argc, argv); +#ifdef Q_OS_WIN + // QCoreApplication::applicationDirPath() needs an Application object instantiated first + // Let's hope that there won't be a crash before this line + const char *envName = "_NT_SYMBOL_PATH"; + const QString envValue = qEnvironmentVariable(envName); + if (envValue.isEmpty()) + qputenv(envName, Application::applicationDirPath().toLocal8Bit()); + else + qputenv(envName, u"%1;%2"_qs.arg(envValue, Application::applicationDirPath()).toLocal8Bit()); +#endif + const QBtCommandLineParameters params = app->commandLineArgs(); if (!params.unknownParameter.isEmpty()) {