From 0b72a16541cc6efa4ebc3dda9a68b0b8c7aaf352 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 29 Sep 2014 19:25:41 +0300 Subject: Pretend the app-specific "Documents" directory is the home directory on iOS Change-Id: If8fda4b27adb2f83cbdfdbb20d90ced77e467a54 --- sal/osl/unx/security.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'sal') diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx index a7c32a963f3b..3dff65426221 100644 --- a/sal/osl/unx/security.cxx +++ b/sal/osl/unx/security.cxx @@ -22,6 +22,12 @@ #include #include +#ifdef IOS +#include +#import +#include +#endif + #include "system.h" #include @@ -324,6 +330,19 @@ static bool SAL_CALL osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszDirec } #endif +#ifdef IOS + { + // Let's pretend the app-specific "Documents" directory is the home directory for now + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString *userDirectory = [paths objectAtIndex:0]; + if ([userDirectory length] < nMax) + { + strcpy(pszDirectory, [userDirectory UTF8String]); + return sal_True; + } + } +#endif + /* if current user, check also environment for HOME */ if (getuid() == pSecImpl->m_pPasswd.pw_uid) { -- cgit