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:
JosJuice
2020-06-26 17:52:31 +02:00
parent d9f3e382fe
commit 6e1e6d2311
10 changed files with 114 additions and 5 deletions

View File

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