mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-13 11:39:09 +00:00
Android: Add content provider support to File::IOFile
Taking the hit now to prepare us for when Google Play will force us to use scoped storage...
This commit is contained in:
parent
d9f3e382fe
commit
6e1e6d2311
10 changed files with 114 additions and 5 deletions
|
@ -0,0 +1,23 @@
|
|||
package org.dolphinemu.dolphinemu.utils;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
import org.dolphinemu.dolphinemu.DolphinApplication;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
public class ContentHandler
|
||||
{
|
||||
public static int openFd(String uri, String mode)
|
||||
{
|
||||
try
|
||||
{
|
||||
return DolphinApplication.getAppContext().getContentResolver()
|
||||
.openFileDescriptor(Uri.parse(uri), mode).detachFd();
|
||||
}
|
||||
catch (FileNotFoundException | NullPointerException e)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue