예제 #1
0
 public static void createDirectories() {
   final String[] dirs = {
     Paths.getHomeDirectory(),
     Paths.getLogsDirectory(),
     Paths.getCacheDirectory(),
     Paths.getSettingsDirectory(),
     Paths.getScriptsDirectory(),
     Paths.getScriptsSourcesDirectory(),
     Paths.getScriptsPrecompiledDirectory(),
     Paths.getScriptsNetworkDirectory(),
   };
   for (final String name : dirs) {
     final File dir = new File(name);
     if (!dir.isDirectory()) {
       dir.mkdirs();
     }
   }
   if (Configuration.getCurrentOperatingSystem() == Configuration.OperatingSystem.WINDOWS) {
     try {
       Runtime.getRuntime()
           .exec(
               "attrib +H \""
                   + new File(Paths.getScriptsNetworkDirectory()).getAbsolutePath()
                   + "\"");
     } catch (final IOException ignored) {
     }
   }
 }
예제 #2
0
 public static String getAccountsFile() {
   final String path;
   if (Configuration.getCurrentOperatingSystem() == OperatingSystem.WINDOWS) {
     path = System.getenv("APPDATA") + File.separator + Configuration.NAME + "_Accounts.ini";
   } else {
     path = Paths.getUnixHome() + File.separator + "." + Configuration.NAME_LOWERCASE + "acct";
   }
   return path;
 }
예제 #3
0
 public static String getHomeDirectory() {
   final String env = System.getenv(Configuration.NAME.toUpperCase() + "_HOME");
   if (env == null || env.isEmpty()) {
     return (Configuration.getCurrentOperatingSystem() == OperatingSystem.WINDOWS
             ? FileSystemView.getFileSystemView().getDefaultDirectory().getAbsolutePath()
             : Paths.getUnixHome())
         + File.separator
         + Configuration.NAME;
   } else {
     return env;
   }
 }