[Android] Check db folder is writable to init medialibrary

Geoffrey Métais git at videolan.org
Thu Oct 5 15:18:04 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Oct  5 15:17:21 2017 +0200| [77158fbf3c9ef29879e2329b6614b0dbca3fb00b] | committer: Geoffrey Métais

Check db folder is writable to init medialibrary

> https://code.videolan.org/videolan/vlc-android/commit/77158fbf3c9ef29879e2329b6614b0dbca3fb00b
---

 medialibrary/src/org/videolan/medialibrary/Medialibrary.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index 1ca67ebd2..3ef504216 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -87,7 +87,8 @@ public class Medialibrary {
         sContext = context;
         File extFilesDir = context.getExternalFilesDir(null);
         File dbDirectory = context.getDir("db", Context.MODE_PRIVATE);
-        if (extFilesDir == null || !extFilesDir.exists())
+        if (extFilesDir == null || !extFilesDir.exists()
+                || dbDirectory == null || !dbDirectory.canWrite())
             return false;
         mIsInitiated = nativeInit(dbDirectory+ VLC_MEDIA_DB_NAME, extFilesDir+ THUMBS_FOLDER_NAME);
         return mIsInitiated;



More information about the Android mailing list