diff --git a/toolkit/crashreporter/client/crashreporter.cpp b/toolkit/crashreporter/client/crashreporter.cpp index 387bc1d5254..e695f8bfcbd 100644 --- a/toolkit/crashreporter/client/crashreporter.cpp +++ b/toolkit/crashreporter/client/crashreporter.cpp @@ -500,11 +500,19 @@ int main(int argc, char** argv) // Hopefully the settings path exists in the environment. Try that before // asking the platform-specific code to guess. +#ifdef XP_WIN32 + static const wchar_t kDataDirKey[] = L"MOZ_CRASHREPORTER_DATA_DIRECTORY"; + const wchar_t *settingsPath = _wgetenv(kDataDirKey); + if (settingsPath && *settingsPath) { + gSettingsPath = WideToUTF8(settingsPath); + } +#else static const char kDataDirKey[] = "MOZ_CRASHREPORTER_DATA_DIRECTORY"; const char *settingsPath = getenv(kDataDirKey); if (settingsPath && *settingsPath) { gSettingsPath = settingsPath; } +#endif else { string product = queryParameters["ProductName"]; string vendor = queryParameters["Vendor"]; diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index 8312f7d1f81..3c6eedc6f6a 100755 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -608,27 +608,31 @@ nsresult SetupExtraData(nsILocalFile* aAppDataDirectory, NS_ENSURE_SUCCESS(rv, rv); } - // Save this path in the environment for the crash reporter application. - nsCAutoString dataDirEnv("MOZ_CRASHREPORTER_DATA_DIRECTORY="); - #if defined(XP_WIN32) + nsAutoString dataDirEnv(NS_LITERAL_STRING("MOZ_CRASHREPORTER_DATA_DIRECTORY=")); + nsAutoString dataDirectoryPath; rv = dataDirectory->GetPath(dataDirectoryPath); NS_ENSURE_SUCCESS(rv, rv); - AppendUTF16toUTF8(dataDirectoryPath, dataDirEnv); + dataDirEnv.Append(dataDirectoryPath); + + _wputenv(dataDirEnv.get()); #else + // Save this path in the environment for the crash reporter application. + nsCAutoString dataDirEnv("MOZ_CRASHREPORTER_DATA_DIRECTORY="); + nsCAutoString dataDirectoryPath; rv = dataDirectory->GetNativePath(dataDirectoryPath); NS_ENSURE_SUCCESS(rv, rv); dataDirEnv.Append(dataDirectoryPath); -#endif char* env = ToNewCString(dataDirEnv); NS_ENSURE_TRUE(env, NS_ERROR_OUT_OF_MEMORY); PR_SetEnv(env); +#endif nsCAutoString data; if(NS_SUCCEEDED(GetOrInit(dataDirectory, NS_LITERAL_CSTRING("UserID"),