ref: 50a9209451c63397a2aaccf9a3ae11ae29d3d707
parent: 3a322908f40dd16df76e2bfb9516eb052dc7933c
author: Romain Bentz <[email protected]>
date: Tue Oct 27 14:17:09 EDT 2015
Fix CSS key caching on Android Signed-off-by: Jean-Baptiste Kempf <[email protected]>
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -216,6 +216,18 @@
psz_cache = dvdcss->psz_cachefile;
}
#else
+#ifdef __ANDROID__
+ /* $HOME is not writable on __ANDROID__ so we have to create a custom
+ * directory in userland */
+ char *psz_home = "/sdcard/Android/data/org.videolan.dvdcss";
+
+ int i_ret = mkdir( psz_home, 0755 );
+ if( i_ret < 0 && errno != EEXIST )
+ {
+ print_error( dvdcss, "failed creating home directory" );
+ psz_home = NULL;
+ }
+#else
char *psz_home = NULL;
#ifdef HAVE_PWD_H
struct passwd *p_pwd;
@@ -227,6 +239,8 @@
psz_home = p_pwd->pw_dir;
}
#endif /* HAVE_PWD_H */
+
+#endif /* __ANDROID__ */
if( psz_home == NULL )
{