From 6ebf8368a5cdec0d0e5a44dc5191d2b7c040240f Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Fri, 13 Jan 2017 11:50:12 +0100 Subject: Crashdump: Make crash directory configurable Change-Id: I8106ec674080ede7072581dab2e6700040de5828 Reviewed-on: https://gerrit.libreoffice.org/33032 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- desktop/source/app/crashreport.cxx | 24 +++++++++++++----------- instsetoo_native/CustomTarget_setup.mk | 9 +++++++++ instsetoo_native/Package_setup.mk | 1 + scp2/source/ooo/common_brand.scp | 14 ++++++++++++++ 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx index 7ec47236535a..ce083d8c6ace 100644 --- a/desktop/source/app/crashreport.cxx +++ b/desktop/source/app/crashreport.cxx @@ -90,15 +90,17 @@ 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 aProfilePath; - osl::FileBase::getSystemPathFromFileURL(url, aProfilePath); - return aProfilePath; + OUString aCrashURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("crashreport") ":CrashDirectory}/"); + rtl::Bootstrap::expandMacros(aCrashURL); + // Need to convert to URL in case of user-defined path + osl::FileBase::getFileURLFromSystemPath(aCrashURL, aCrashURL); + osl::Directory::create(aCrashURL); + + OUString aCrashPath; + osl::FileBase::getSystemPathFromFileURL(aCrashURL, aCrashPath); + return aCrashPath; } } @@ -106,12 +108,12 @@ OUString getCrashUserProfileDirectory() void CrashReporter::updateMinidumpLocation() { #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID - OUString aURL = getCrashUserProfileDirectory(); + OUString aURL = getCrashDirectory(); OString aOStringUrl = OUStringToOString(aURL, RTL_TEXTENCODING_UTF8); google_breakpad::MinidumpDescriptor descriptor(aOStringUrl.getStr()); mpExceptionHandler->set_minidump_descriptor(descriptor); #elif defined WNT - OUString aURL = getCrashUserProfileDirectory(); + OUString aURL = getCrashDirectory(); mpExceptionHandler->set_dump_path(aURL.getStr()); #endif } @@ -123,7 +125,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; diff --git a/instsetoo_native/CustomTarget_setup.mk b/instsetoo_native/CustomTarget_setup.mk index 3226cd66580f..73042e3e6bde 100644 --- a/instsetoo_native/CustomTarget_setup.mk +++ b/instsetoo_native/CustomTarget_setup.mk @@ -19,6 +19,7 @@ $(eval $(call gb_CustomTarget_register_targets,instsetoo_native/setup,\ $(call gb_Helper_get_rcfile,soffice) \ $(call gb_Helper_get_rcfile,uno) \ $(call gb_Helper_get_rcfile,version) \ + $(call gb_Helper_get_rcfile,crashreport) \ )) $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_rcfile,bootstrap) \ @@ -29,6 +30,7 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_rcfile,soffice) \ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_rcfile,uno) \ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_rcfile,version) \ +$(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_rcfile,crashreport) \ : $(SRCDIR)/instsetoo_native/CustomTarget_setup.mk $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_rcfile,bootstrap) : @@ -143,6 +145,13 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_ && echo 'UNO_SERVICES=$(if $(filter MACOSX,$(OS)),$${ORIGIN}/../share/misc/,$${ORIGIN}/)services.rdb $${URE_MORE_SERVICES}' \ ) > $@ +$(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_rcfile,crashreport) : + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1) + ( \ + echo '[CrashReport]' \ + && echo 'CrashDirectory=$${$$BRAND_BASE_DIR/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,bootstrap):UserInstallation}/crash' \ + ) > $@ + .PHONY: $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_rcfile,version) $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_rcfile,version) : $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1) diff --git a/instsetoo_native/Package_setup.mk b/instsetoo_native/Package_setup.mk index 5b1e42794532..6ee95dc4d372 100644 --- a/instsetoo_native/Package_setup.mk +++ b/instsetoo_native/Package_setup.mk @@ -18,6 +18,7 @@ $(eval $(call gb_Package_add_files,instsetoo_native_setup,$(LIBO_ETC_FOLDER),\ $(call gb_Helper_get_rcfile,soffice) \ $(call gb_Helper_get_rcfile,louno) \ $(call gb_Helper_get_rcfile,version) \ + $(call gb_Helper_get_rcfile,crashreport) \ )) # vim: set noet sw=4 ts=4: diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp index 7eb4e0e6ba6d..5ba90d0ef618 100644 --- a/scp2/source/ooo/common_brand.scp +++ b/scp2/source/ooo/common_brand.scp @@ -634,6 +634,12 @@ Profile gid_Brand_Profile_Fundamental_Ini Dir = GID_BRAND_DIR_ETC; End +Profile gid_Brand_Profile_Crashreport_Ini + ModuleID = gid_Module_Root_Brand; + Name = PROFILENAME(crashreport); + Dir = GID_BRAND_DIR_ETC; +End + #if !defined MACOSX Profile gid_Brand_Profile_Redirect_Ini ModuleID = gid_Module_Root_Brand; @@ -1199,3 +1205,11 @@ ProfileItem gid_Brand_Profileitem_Setup_Install Styles = (INIFILETABLE); End #endif + +ProfileItem gid_Brand_Profileitem_CrashReport_Path + ProfileID = gid_Brand_Profile_Crashreport_Ini; + ModuleID = gid_Module_Root_Brand; + Section = "CrashReport"; + Key = "CrashDirectory"; + Value = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" PROFILENAME(bootstrap) ":UserInstallation}/crash"; +End -- cgit