summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-01-13 11:50:12 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-01-18 15:26:27 +0100
commit4e6c8db47081000c9597d565528db2b1b8cfd8c8 (patch)
tree3653d0fc4209f417914743d59135768f04ef2db8
parentfb1925f72ce7f60c52791f13d5f5508ab87d5962 (diff)
Crashdump: Make crash directory configurable
Change-Id: I8106ec674080ede7072581dab2e6700040de5828
-rw-r--r--desktop/source/app/crashreport.cxx30
1 files changed, 21 insertions, 9 deletions
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index b98267a13c67..e69417111c80 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -83,22 +83,34 @@ 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);
+ 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
@@ -116,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;