Skip to content

Commit

Permalink
fix: stop trying to create folder if it does exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jd1378 committed Aug 30, 2022
1 parent 1eea651 commit 75f53c4
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,12 @@ public DocumentFile goToDocument(
: uri.getPath().length() - uri.getLastPathSegment().length());

if (createIfDirectoryNotExist) {
boolean madeFolder = new File(path).mkdirs();
if (!madeFolder) {
throw new IOException("mkdir failed for Uri with `file` scheme");
File targetFile = new File(path);
if (!targetFile.exists()) {
boolean madeFolder = targetFile.mkdirs();
if (!madeFolder) {
throw new IOException("mkdir failed for Uri with `file` scheme");
}
}
}
DocumentFile targetFile = DocumentFile.fromFile(new File(path));
Expand Down

0 comments on commit 75f53c4

Please sign in to comment.