Skip to content

Commit

Permalink
* Catch SecurityException in Loader.getCacheDir() (pull #198)
Browse files Browse the repository at this point in the history
Logic in the area will already try the next directory.
  • Loading branch information
hakanai authored and saudet committed Aug 24, 2017
1 parent 8f92fc3 commit 936dd64
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/org/bytedeco/javacpp/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,14 @@ public static File getCacheDir() throws IOException {
System.getProperty("java.io.tmpdir") + "/.javacpp-" + System.getProperty("user.name") + "/cache/"};
for (String dirName : dirNames) {
if (dirName != null) {
File f = new File(dirName);
if (f.exists() || f.mkdirs()) {
cacheDir = f;
break;
try {
File f = new File(dirName);
if (f.exists() || f.mkdirs()) {
cacheDir = f;
break;
}
} catch (SecurityException e) {
// No access, try the next option.
}
}
}
Expand Down

0 comments on commit 936dd64

Please sign in to comment.