[Libreoffice-commits] core.git: Branch 'feature/cib_contract57' - desktop/source
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Fri Jan 13 10:54:48 UTC 2017
desktop/source/app/crashreport.cxx | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
New commits:
commit ea6a24234138eb3cea1cde3c4abcf36845d05d20
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Fri Jan 13 11:50:12 2017 +0100
Crashdump: Make crash directory configurable
Change-Id: I8106ec674080ede7072581dab2e6700040de5828
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index 04b234f..9359113 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -82,22 +82,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
@@ -115,7 +127,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;
More information about the Libreoffice-commits
mailing list