List of usage examples for java.io File canExecute
public boolean canExecute()
From source file:ch.vorburger.mariadb4j.Util.java
public static void forceExecutable(File executableFile) throws IOException { if (executableFile.exists() && !executableFile.canExecute()) { boolean succeeded = executableFile.setExecutable(true); if (succeeded) { logger.info("chmod +x " + executableFile.toString() + " (using java.io.File.setExecutable)"); } else {//from w w w . j a v a2s . c o m throw new IOException("Failed to do chmod +x " + executableFile.toString() + " using java.io.File.setExecutable, which will be a problem on *NIX..."); } } }
From source file:com.thoughtworks.gauge.util.GaugeUtil.java
private static boolean isValidGaugeExec(File file) { return file.exists() && file.isFile() && file.canExecute(); }
From source file:org.kalypso.wspwin.core.Plotter.java
/** * Returns the configured plotter.exe and also checks if it still exists and can be executed. If not, <code>null</code> is returned. *///from ww w . j av a 2 s . c om public static File getPlotterExeChecked() { final File plotterExe = getPlotterExe(); if (plotterExe != null && plotterExe.exists() && plotterExe.isFile() && plotterExe.canExecute()) return plotterExe; return null; }
From source file:utils.HelperMethods.java
/** * Stores the passed in radio map file inside the server's system for later retrieval if needed and offline processing on the server * @param file/*w ww. j av a 2 s. co m*/ * @return */ public static boolean storeRadioMapToServer(File file) { String radio_dir = "radio_maps_raw/"; File dir = new File(radio_dir); dir.mkdirs(); if (!dir.isDirectory() || !dir.canWrite() || !dir.canExecute()) { return false; } String name = "radiomap_" + LPUtils.generateRandomToken() + System.currentTimeMillis(); File dest_f = new File(radio_dir + name); FileOutputStream fout; try { fout = new FileOutputStream(dest_f); Files.copy(file.toPath(), fout); fout.close(); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. return false; } return true; }
From source file:ezbake.deployer.impl.Files.java
public static boolean isExecutable(File file) { return file.canExecute(); }
From source file:org.valable.model.ValaBuildContext.java
public static File getDefaultValacExecutable() { try {//from w ww.j av a 2s . c o m Process process = new ProcessBuilder("which", VALAC_EXE_NAME).start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line = br.readLine(); if (line != null) { File result = new File(line); if (result.canExecute()) { return result; } } } catch (IOException e) { e.printStackTrace(); } File valacExecutable = new File("/usr/bin", VALAC_EXE_NAME); return valacExecutable; }
From source file:org.kalypso.wspwin.core.Plotter.java
/** * Check if the plotter exe is configured. If not the user is asked to choose it in a file dialog. *//*from www. j av a 2 s .co m*/ public static final boolean checkPlotterExe(final Shell shell) { final File plotterExe = getPlotterExe(); if (plotterExe != null && plotterExe.exists() && plotterExe.isFile() && plotterExe.canExecute()) return true; final String message = getPlotterDialogMessage(plotterExe == null); MessageDialog.openWarning(shell, Messages.getString("Plotter_2"), message); //$NON-NLS-1$ final FileDialog dlg = new FileDialog(shell); final FilePattern allFilesFilter = FileExtensions.ALL_FILES; dlg.setFilterNames(new String[] { allFilesFilter.getFilterLabel(), Messages.getString("Plotter_4") }); //$NON-NLS-1$ //$NON-NLS-2$ dlg.setFilterExtensions(new String[] { allFilesFilter.getPattern(), "*.exe" }); //$NON-NLS-1$ //$NON-NLS-2$ dlg.setFilterIndex(1); dlg.setText(Messages.getString("Plotter_7")); //$NON-NLS-1$ final String newPlotterPath = dlg.open(); if (newPlotterPath == null) return false; final IPreferenceStore preferences = getPlotterPreferences(); preferences.setValue(WSPWIN_PLOTTER_PATH, newPlotterPath); return true; }
From source file:io.github.blindio.prospero.core.browserdrivers.phantomjs.PhantomJSInstaller.java
public static String getPhantomJS() { File phantomJS = getPhantomJSExecutableFile(); if (!phantomJS.exists()) { installPhantomJS();/*from w ww. jav a2 s. c om*/ } if (!phantomJS.canExecute()) { phantomJS.setExecutable(true, false); } return phantomJS.getAbsolutePath(); }
From source file:com.zotoh.core.util.FileUte.java
/** * @param dir//from ww w . jav a 2 s.c o m * @return */ public static boolean isDirKosher(File dir) { return dir != null && dir.exists() && dir.canExecute() && dir.canRead() && dir.canWrite(); }
From source file:de.codesourcery.geoip.trace.TracePath.java
private static boolean isTracePathAvailable() { final File executable = new File(TRACEPATH); return executable.exists() && executable.canExecute(); }