List of utility methods to do File Attribute
boolean | patchInfoPList(final File infoPList, final String executable) patch Info P List if (!infoPList.exists()) return false; String contents = readFile(infoPList); final Pattern pattern = Pattern.compile(".*<key>CFBundleExecutable</key>[^<]*<string>([^<]*).*", Pattern.DOTALL | Pattern.MULTILINE); final Matcher matcher = pattern.matcher(contents); if (!matcher.matches()) return false; ... |
void | persistExecutionTimesCsv(String filePath, LinkedList persist Execution Times Csv PrintWriter out = null; try { out = new PrintWriter(new BufferedWriter(new FileWriter(filePath, false))); for (Map.Entry<String, Double> entry : executionTimes) { out.println(entry.getKey() + ";" + entry.getValue()); } finally { if (out != null) { ... |
void | setExecutable(File f, final String pattern) set Executable if (f.isDirectory()) { File[] files = f.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return Pattern.matches(pattern, name); }); for (File bin : files) { ... |
boolean | setExecutable(File file) set Executable try { new FilePermission(file.getAbsolutePath(), "execute"); return true; } catch (Exception e) { return false; |
void | setExecutable(File file, boolean executable) set Executable if (executable && !file.setExecutable(true)) { throw new IOException("Cannot set executable permissions for: " + file); |
void | setExecutable(String filesList) set Executable Runtime.getRuntime().exec("chmod u+x " + filesList);
|
boolean | setExecute(File f, boolean b) set Execute try { Process p = null; String cmd = null; cmd = "chmod " + "u+x" + " " + f.getAbsolutePath(); p = Runtime.getRuntime().exec(cmd); } catch (Exception e) { e.printStackTrace(); return false; ... |
boolean | setExecute(String path) set Execute try { Process proc = Runtime.getRuntime().exec(new String[] { "chmod", "a+x", path }); proc.waitFor(); return true; } catch (InterruptedException ex) { } catch (IOException ex) { return false; ... |
void | setExecutePermissions(final File scriptfile) Set the executable flag on a file if supported by the OS if (!scriptfile.setExecutable(true, true)) { System.err.println("Unable to set executable bit on temp script file, execution may fail: " + scriptfile.getAbsolutePath()); |
void | setRecursiveExecutable(File path) set Recursive Executable for (File f : path.listFiles()) { if (f.isDirectory()) { f.setExecutable(true); setRecursiveExecutable(f); } else if (!f.canExecute() && (f.getName().endsWith(".so") || f.getName().endsWith(".dll"))) { f.setExecutable(true); |