summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-01-13 11:50:12 +0100
committerKatarina Behrens <Katarina.Behrens@cib.de>2017-01-18 11:54:18 +0100
commita6b457d5b6571b04e5746e56cc40edc9bcd82a30 (patch)
treec60c8e930cf0f8335a7af4b691dbda60aff5ac7b
parent747f5023c44d709cae8fb6f15306afd9480baff9 (diff)
Crashdump: Make crash directory configurable
Change-Id: I8106ec674080ede7072581dab2e6700040de5828
-rw-r--r--desktop/source/app/crashreport.cxx31
1 files changed, 22 insertions, 9 deletions
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index 04b234f38a75..64cbd105bee3 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -82,22 +82,35 @@ void CrashReporter::writeCommonInfo()
namespace {
-OUString getCrashUserProfileDirectory()
+OUString getCrashDirectory()
{
- OUString url("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/crash/");
- rtl::Bootstrap::expandMacros(url);
- osl::Directory::create(url);
+ OUString aCrashURL;
- OUString aProfilePath;
- osl::FileBase::getSystemPathFromFileURL(url, aProfilePath);
- return aProfilePath;
+ // First check whether a user-defined path is available (crashreport.ini)
+ OUString aCrashPath("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("crashreport") ":CrashDirectory}");
+ rtl::Bootstrap::expandMacros(aCrashPath);
+ osl::FileBase::getFileURLFromSystemPath(aCrashPath, aCrashURL);
+
+ // Fall back to user profile
+ if (aCrashPath.isEmpty())
+ {
+ aCrashURL = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/crash";
+ rtl::Bootstrap::expandMacros(aCrashURL);
+ }
+
+ if (!aCrashURL.endsWith("/"))
+ aCrashURL += "/";
+ osl::FileBase::RC rc = osl::Directory::create(aCrashURL);
+ (void)rc;
+ osl::FileBase::getSystemPathFromFileURL(aCrashURL, aCrashPath);
+ return aCrashPath;
}
}
void CrashReporter::updateMinidumpLocation()
{
- OUString aURL = getCrashUserProfileDirectory();
+ OUString aURL = getCrashDirectory();
OString aOStringUrl = OUStringToOString(aURL, RTL_TEXTENCODING_UTF8);
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
@@ -115,7 +128,7 @@ void CrashReporter::storeExceptionHandler(google_breakpad::ExceptionHandler* pEx
std::string CrashReporter::getIniFileName()
{
- OUString url = getCrashUserProfileDirectory() + "dump.ini";
+ OUString url = getCrashDirectory() + "dump.ini";
OString aUrl = OUStringToOString(url, RTL_TEXTENCODING_UTF8);
std::string aRet(aUrl.getStr());
return aRet;