Android: Add content provider support to File::Delete

This commit is contained in:
JosJuice
2020-06-27 11:04:48 +02:00
parent 6e1e6d2311
commit 3805b84906
6 changed files with 49 additions and 2 deletions

View File

@ -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;
}
}
}