Commit 3e9fbe0d authored by Geoffrey Métais's avatar Geoffrey Métais

Move database in app files directory

Application cache could be erased
parent d64a4229
......@@ -76,11 +76,10 @@ public class Medialibrary {
public boolean init(Context context) {
if (context == null)
return false;
File cacheDir = context.getCacheDir();
File extFilesDir = context.getExternalFilesDir(null);
if (extFilesDir == null || !cacheDir.exists() || !extFilesDir.exists())
if (extFilesDir == null || !extFilesDir.exists())
return false;
mIsInitiated = nativeInit(cacheDir+ VLC_MEDIA_DB_NAME, extFilesDir.getAbsolutePath()+ THUMBS_FOLDER_NAME);
mIsInitiated = nativeInit(extFilesDir.getAbsolutePath()+ VLC_MEDIA_DB_NAME, extFilesDir.getAbsolutePath()+ THUMBS_FOLDER_NAME);
return mIsInitiated;
}
......
......@@ -216,7 +216,7 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
mCallsExecutor.execute(new Runnable() {
@Override
public void run() {
boolean shouldInit = !(new File(MediaParsingService.this.getCacheDir()+Medialibrary.VLC_MEDIA_DB_NAME).exists());
boolean shouldInit = !(new File(MediaParsingService.this.getExternalFilesDir(null)+Medialibrary.VLC_MEDIA_DB_NAME).exists());
if (mMedialibrary.init(VLCApplication.getAppContext())) {
List<String> devices = new ArrayList<>();
devices.add(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment