Skip to content

Commit c981001

Browse files
committed
Fix open implementation in VfsImplementationSaf.java not creating files that don't exist
1 parent 8855b87 commit c981001

1 file changed

Lines changed: 4 additions & 20 deletions

File tree

libretro-common/vfs/saf/src/com/libretro/common/vfs/VfsImplementationSaf.java

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ else if (!read)
9191
{
9292
return content.openFileDescriptor(fileUri, mode).detachFd();
9393
}
94-
catch (FileNotFoundException e)
94+
catch (FileNotFoundException | IllegalArgumentException e)
9595
{
9696
if (createdFile || !write)
9797
return -1;
@@ -105,18 +105,10 @@ else if (!read)
105105
{
106106
DocumentsContract.createDocument(content, parentUri, "application/octet-stream", filePath.getFileName().toString());
107107
}
108-
catch (FileNotFoundException f)
108+
catch (FileNotFoundException | IllegalArgumentException f)
109109
{
110110
return -1;
111111
}
112-
catch (IllegalArgumentException f)
113-
{
114-
return -1;
115-
}
116-
}
117-
catch (IllegalArgumentException e)
118-
{
119-
return -1;
120112
}
121113
}
122114
}
@@ -146,11 +138,7 @@ public static boolean removeSafFile(ContentResolver content, String tree, String
146138
{
147139
DocumentsContract.deleteDocument(content, fileUri);
148140
}
149-
catch (FileNotFoundException e)
150-
{
151-
return false;
152-
}
153-
catch (IllegalArgumentException e)
141+
catch (FileNotFoundException | IllegalArgumentException e)
154142
{
155143
return false;
156144
}
@@ -296,11 +284,7 @@ public static int mkdirSaf(ContentResolver content, String tree, String path)
296284
if (DocumentsContract.createDocument(content, parentUri, Document.MIME_TYPE_DIR, directoryPath.getFileName().toString()) == null)
297285
return -1;
298286
}
299-
catch (FileNotFoundException e)
300-
{
301-
return -1;
302-
}
303-
catch (IllegalArgumentException e)
287+
catch (FileNotFoundException | IllegalArgumentException e)
304288
{
305289
return -1;
306290
}

0 commit comments

Comments
 (0)