From af335e5bc8621df98257dc158238bfda15ebab42 Mon Sep 17 00:00:00 2001 From: Gabriele Svelto <gsvelto@mozilla.com> Date: Tue, 27 Feb 2024 15:04:10 +0000 Subject: [PATCH] Bug 1882080 - Don't use double dots in the path used to restart Firefox on macOS r=afranchuk, a=dmeehan Differential Revision: https://phabricator.services.mozilla.com/D202789 --- toolkit/crashreporter/client/crashreporter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/toolkit/crashreporter/client/crashreporter.cpp b/toolkit/crashreporter/client/crashreporter.cpp index a14ea14fbc0be..fa3d51762d04a 100644 --- a/toolkit/crashreporter/client/crashreporter.cpp +++ b/toolkit/crashreporter/client/crashreporter.cpp @@ -544,7 +544,12 @@ string GetProgramPath(const string& exename) { // The other applications we ship with Firefox are stored in the main bundle // (Firefox.app/Contents/MacOS/) so we we need to go back three directories // to reach them. - path.append("../../../"); + path.erase(pos - 1); + for (size_t i = 0; i < 3; i++) { + pos = path.rfind(UI_DIR_SEPARATOR, pos - 1); + } + + path.erase(pos + 1); #endif // XP_MACOSX path.append(exename + BIN_SUFFIX); -- GitLab