summaryrefslogtreecommitdiff
path: root/sal/osl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-09-29 19:25:41 +0300
committerTor Lillqvist <tml@collabora.com>2014-09-29 19:39:02 +0300
commit0b72a16541cc6efa4ebc3dda9a68b0b8c7aaf352 (patch)
treea399968e5c16689aa6415677f3dc298c0ab71f18 /sal/osl
parentd680f6c924148a20a994ae2fb6898fabcffe7f77 (diff)
Pretend the app-specific "Documents" directory is the home directory on iOS
Change-Id: If8fda4b27adb2f83cbdfdbb20d90ced77e467a54
Diffstat (limited to 'sal/osl')
-rw-r--r--sal/osl/unx/security.cxx19
1 files changed, 19 insertions, 0 deletions
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 <cstddef>
#include <limits>
+#ifdef IOS
+#include <premac.h>
+#import <Foundation/Foundation.h>
+#include <postmac.h>
+#endif
+
#include "system.h"
#include <osl/security.h>
@@ -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)
{