bug 440634 - error passing DBCS settings path to crash reporter. r=bsmedberg

This commit is contained in:
Ted Mielczarek 2008-06-24 16:15:35 -04:00
Родитель bc495cd8cd
Коммит 327c7aa8cb
2 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -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"];

Просмотреть файл

@ -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"),