From 3b5728de6f2d8d2852fbb86fa8cac21e6dccc19b Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Mon, 4 May 2015 22:11:28 +0200 Subject: Build a file browser looking like Finder --- src/de/fhswf/fbin/java2fx/util/FileUtils.java | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/de/fhswf/fbin/java2fx/util/FileUtils.java (limited to 'src/de/fhswf/fbin/java2fx/util/FileUtils.java') 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(); + } +} -- cgit v1.2.3-70-g09d2