mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-20 03:01:02 +00:00
ANDROID: Add a method to get a ParcelFileDescriptor from a SAFFSNode
This commit is contained in:
parent
1a76acc938
commit
c1827fd420
@ -439,7 +439,7 @@ public class SAFFSTree {
|
||||
return newnode;
|
||||
}
|
||||
|
||||
private int createStream(SAFFSNode node, String mode) {
|
||||
public ParcelFileDescriptor createFileDescriptor(SAFFSNode node, String mode) {
|
||||
final ContentResolver resolver = _context.getContentResolver();
|
||||
final Uri uri = DocumentsContract.buildDocumentUriUsingTree(_treeUri, node._documentId);
|
||||
|
||||
@ -447,12 +447,17 @@ public class SAFFSTree {
|
||||
try {
|
||||
pfd = resolver.openFileDescriptor(uri, mode);
|
||||
} catch(FileNotFoundException e) {
|
||||
return -1;
|
||||
return null;
|
||||
}
|
||||
|
||||
return pfd;
|
||||
}
|
||||
|
||||
private int createStream(SAFFSNode node, String mode) {
|
||||
ParcelFileDescriptor pfd = createFileDescriptor(node, mode);
|
||||
if (pfd == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return pfd.detachFd();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user