mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Android: Add content provider support to File::Delete
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user