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 committed 2020-09-16 18:38:53 +02:00
1 parent d9f3e382fe
commit 6e1e6d2311
10 files changed
+114 -5

No files matched your search

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