diff options
-rw-r--r-- | instsetoo_native/CustomTarget_setup.mk | 2 | ||||
-rw-r--r-- | sal/osl/unx/security.cxx | 35 |
2 files changed, 35 insertions, 2 deletions
diff --git a/instsetoo_native/CustomTarget_setup.mk b/instsetoo_native/CustomTarget_setup.mk index ebeb00dcd019..da4f697993df 100644 --- a/instsetoo_native/CustomTarget_setup.mk +++ b/instsetoo_native/CustomTarget_setup.mk @@ -40,7 +40,7 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_ && echo 'InstallMode=<installmode>' \ && echo 'ProductKey=$(PRODUCTNAME) $(PRODUCTVERSION)' \ $(if $(ENABLE_RELEASE_BUILD),\ - && echo 'UserInstallation=$$SYSUSERCONFIG/$(if $(filter-out MACOSX WNT,$(OS)),$(shell echo $(PRODUCTNAME) | tr "[:upper:]" "[:lower:]"),$(shell echo $(PRODUCTNAME) | sed -e 's/ /%20/g'))/4', \ + && echo 'UserInstallation=$$SYSUSERCONFIG/$(if $(filter-out HAIKU MACOSX WNT,$(OS)),$(shell echo $(PRODUCTNAME) | tr "[:upper:]" "[:lower:]"),$(shell echo $(PRODUCTNAME) | sed -e 's/ /%20/g'))/4', \ && echo 'UserInstallation=$$ORIGIN/..') \ ) > $@ diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx index 49a0320bc023..a7a47640c693 100644 --- a/sal/osl/unx/security.cxx +++ b/sal/osl/unx/security.cxx @@ -41,6 +41,11 @@ #include <crypt.h> #endif +#if defined HAIKU +#include <fs_info.h> +#include <FindDirectory.h> +#endif + #include "secimpl.hxx" #ifdef ANDROID @@ -246,6 +251,18 @@ static bool osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszDirectory, sal if (pSecImpl == nullptr) return false; +#ifdef HAIKU + dev_t volume = dev_for_path("/boot"); + sal_Char homeDir[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH]; + status_t result = find_directory(B_USER_DIRECTORY, volume, false, homeDir, + sizeof(homeDir)); + if (result == B_OK && strlen(homeDir) < nMax) { + strcpy(pszDirectory, homeDir); + return true; + } + return false; +#endif + #ifdef ANDROID { sal_Bool bRet = sal_False; @@ -347,7 +364,23 @@ sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString **pustrDire return bRet; } -#if !defined(MACOSX) && !defined(IOS) +#if defined HAIKU + +static bool osl_psz_getConfigDir(oslSecurity Security, sal_Char* pszDirectory, sal_uInt32 nMax) +{ + (void) Security; + dev_t volume = dev_for_path("/boot"); + sal_Char configDir[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH]; + status_t result = find_directory(B_USER_SETTINGS_DIRECTORY, volume, false, + configDir, sizeof(configDir)); + if (result == B_OK && strlen(configDir) < nMax) { + strcpy(pszDirectory, configDir); + return true; + } + return false; +} + +#elif !defined(MACOSX) && !defined(IOS) #define DOT_CONFIG "/.config" |