aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-05-01 01:05:01 -0500
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-05-01 01:05:01 -0500
commit496befb51f8f876ab62f78b524e612d940b02956 (patch)
tree4846c3ee630754783dad4e5207883379dd820be2
parent4bb4fe5ca0e7e75533d908a91f0d7aa086db9e61 (diff)
Port upstream PR #2379: reset CWD to app dir on startup
When MO2 is launched by the nxm handler from a browser, CWD is whatever the browser inherited (often /, $HOME, or the user's Desktop). Reset it to the application directory so any code path relying on CWD behaves the same as a normal launch. Cherry-picked from upstream f80ad04. Comment expanded for the Linux context (Qt resource lookup, relative QFile paths, QtWebEngine sandbox helper) — upstream's note only covered QtWebEngineProcess on Windows. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
-rw-r--r--src/src/moapplication.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/src/moapplication.cpp b/src/src/moapplication.cpp
index 40ec09a..0c50509 100644
--- a/src/src/moapplication.cpp
+++ b/src/src/moapplication.cpp
@@ -218,6 +218,13 @@ MOApplication::MOApplication(int& argc, char** argv) : QApplication(argc, argv)
#ifdef MO2_WEBENGINE
configureQtWebEngineProcessPath();
#endif
+
+ // When MO2 is launched by the nxm handler from a browser, CWD is whatever
+ // the browser inherited (often /, $HOME, or the user's Desktop). Reset it
+ // to the application directory so that any code path relying on CWD
+ // (Qt resource lookup, relative QFile paths, QtWebEngine sandbox helper)
+ // behaves the same as a normal launch. Upstream PR #2379.
+ QDir::setCurrent(QCoreApplication::applicationDirPath());
}
OrganizerCore& MOApplication::core()