Android: Add content provider support to File::Delete

This commit is contained in:
JosJuice committed 2020-09-16 18:38:53 +02:00
1 parent 6e1e6d2311
commit 3805b84906
6 files changed
+49 -2

No files matched your search

@@ -1,6 +1,8 @@
package org.dolphinemu.dolphinemu.utils;
import android.content.ContentResolver;
import android.net.Uri;
import android.provider.DocumentsContract;
import org.dolphinemu.dolphinemu.DolphinApplication;
@@ -20,4 +22,18 @@ public class ContentHandler
return -1;
}
}
public static boolean delete(String uri)
{
try
{
ContentResolver resolver = DolphinApplication.getAppContext().getContentResolver();
return DocumentsContract.deleteDocument(resolver, Uri.parse(uri));
}
catch (FileNotFoundException e)
{
// Return true because we care about the file not being there, not the actual delete.
return true;
}
}
}