summaryrefslogtreecommitdiffstats
path: root/src/de/fhswf/fbin/java2fx/util/FileUtils.java
blob: fb672969881326e2c94fb0d288303934e54c00c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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();
   }
}