diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /toolkit/crashreporter/nsExceptionHandler.cpp | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/crashreporter/nsExceptionHandler.cpp')
-rw-r--r-- | toolkit/crashreporter/nsExceptionHandler.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index 868005a5c7..0f8a58aa88 100644 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -96,6 +96,9 @@ using mozilla::InjectCrashRunnable; #endif +#ifdef XP_WIN +# include <filesystem> +#endif #include <fstream> #include <optional> @@ -2768,12 +2771,23 @@ static nsresult PrefSubmitReports(bool* aSubmitReports, bool writePref) { * toolkit/crashreporter/client/app/src/{logic,settings}.rs */ nsCOMPtr<nsIFile> reporterSettings; - rv = NS_GetSpecialDirectory("UAppData", getter_AddRefs(reporterSettings)); + rv = NS_GetSpecialDirectory(XRE_USER_APP_DATA_DIR, + getter_AddRefs(reporterSettings)); NS_ENSURE_SUCCESS(rv, rv); reporterSettings->AppendNative("Crash Reports"_ns); reporterSettings->AppendNative("crashreporter_settings.json"_ns); + // On e.g. Linux, std::filesystem requires sometimes linking libstdc++fs, + // and we don't do that yet, so limit the use of std::filesystem::path where + // it's really needed, which is Windows, because implicit conversions from + // wstring in fstream constructors are not supported as of + // https://cplusplus.github.io/LWG/issue3430. +# ifdef XP_WIN + std::optional<std::filesystem::path> file_path = + CreatePathFromFile(reporterSettings); +# else std::optional<xpstring> file_path = CreatePathFromFile(reporterSettings); +# endif if (!file_path) { return NS_ERROR_FAILURE; @@ -2900,7 +2914,7 @@ void UpdateCrashEventsDir() { return; } - rv = NS_GetSpecialDirectory("UAppData", getter_AddRefs(eventsDir)); + rv = NS_GetSpecialDirectory(XRE_USER_APP_DATA_DIR, getter_AddRefs(eventsDir)); if (NS_SUCCEEDED(rv)) { SetUserAppDataDirectory(eventsDir); return; @@ -2962,7 +2976,8 @@ static void FindPendingDir() { return; } nsCOMPtr<nsIFile> pendingDir; - nsresult rv = NS_GetSpecialDirectory("UAppData", getter_AddRefs(pendingDir)); + nsresult rv = + NS_GetSpecialDirectory(XRE_USER_APP_DATA_DIR, getter_AddRefs(pendingDir)); if (NS_FAILED(rv)) { NS_WARNING( "Couldn't get the user appdata directory, crash dumps will go in an " |