diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-05-04 22:11:28 +0200 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-05-04 22:11:28 +0200 |
| commit | 3b5728de6f2d8d2852fbb86fa8cac21e6dccc19b (patch) | |
| tree | 54965319a9aafeb294dac8e36e4ce1371ec76ef3 /src/de/fhswf/fbin/java2fx/util/FileUtils.java | |
| parent | af7b9bd6a962b9a290fc5d78c08c83653961811f (diff) | |
| download | Java2-3b5728de6f2d8d2852fbb86fa8cac21e6dccc19b.tar.gz Java2-3b5728de6f2d8d2852fbb86fa8cac21e6dccc19b.zip | |
Build a file browser looking like Finder
Diffstat (limited to 'src/de/fhswf/fbin/java2fx/util/FileUtils.java')
| -rw-r--r-- | src/de/fhswf/fbin/java2fx/util/FileUtils.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/de/fhswf/fbin/java2fx/util/FileUtils.java b/src/de/fhswf/fbin/java2fx/util/FileUtils.java new file mode 100644 index 0000000..fb67296 --- /dev/null +++ b/src/de/fhswf/fbin/java2fx/util/FileUtils.java @@ -0,0 +1,29 @@ +package de.fhswf.fbin.java2fx.util; + +import java.io.File; + +public final class FileUtils +{ + private FileUtils() + { + } + + public static boolean isPublicDirectory(File dir) + { + SecurityManager security = System.getSecurityManager(); + boolean isReadable = true; + if (security != null) + { + try + { + security.checkRead(dir.toURI().toString()); + } + catch (Exception e) + { + isReadable = false; + } + } + + return dir.isDirectory() && isReadable && !dir.isHidden(); + } +} |
