summaryrefslogtreecommitdiffstats
path: root/toolkit/crashreporter/nsExceptionHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/crashreporter/nsExceptionHandler.cpp')
-rw-r--r--toolkit/crashreporter/nsExceptionHandler.cpp21
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 "