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::IOFile
Taking the hit now to prepare us for when Google Play will force us to use scoped storage...
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user