bug 412989 - allow per-app override of crashreporter.ini. r=bsmedberg

This commit is contained in:
ted.mielczarek%gmail.com 2008-01-26 16:49:30 +00:00
Родитель 82b476cba3
Коммит 03b2270665
2 изменённых файлов: 32 добавлений и 5 удалений

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

@ -230,6 +230,11 @@ static bool ReadConfig()
if (!ReadStringsFromFile(iniPath, gStrings, true))
return false;
// See if we have a string override file, if so process it
char* overrideEnv = getenv("MOZ_CRASHREPORTER_STRINGS_OVERRIDE");
if (overrideEnv && *overrideEnv && UIFileExists(overrideEnv))
ReadStringsFromFile(overrideEnv, gStrings, true);
return true;
}

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

@ -2657,6 +2657,28 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
getter_AddRefs(userAppDataDir)))) {
CrashReporter::SetupExtraData(userAppDataDir,
nsDependentCString(appData.buildID));
// see if we have a crashreporter-override.ini in the application directory
nsCOMPtr<nsIFile> overrideini;
PRBool exists;
static char overrideEnv[MAXPATHLEN];
if (NS_SUCCEEDED(dirProvider.GetAppDir()->Clone(getter_AddRefs(overrideini))) &&
NS_SUCCEEDED(overrideini->AppendNative(NS_LITERAL_CSTRING("crashreporter-override.ini"))) &&
NS_SUCCEEDED(overrideini->Exists(&exists)) &&
exists) {
#ifdef XP_WIN
nsAutoString overridePathW;
overrideini->GetPath(overridePathW);
NS_ConvertUTF16toUTF8 overridePath(overridePathW);
#else
nsAutoCString overridePath;
overrideini->GetNativePath(overridePath);
#endif
sprintf(overrideEnv, "MOZ_CRASHREPORTER_STRINGS_OVERRIDE=%s",
overridePath.get());
PR_SetEnv(overrideEnv);
}
}
}
#endif