protected static void checkExecutable(File exe) { checkState(exe.exists(), "The driver executable does not exist: %s", exe.getAbsolutePath()); checkState( !exe.isDirectory(), "The driver executable is a directory: %s", exe.getAbsolutePath()); checkState( FileHandler.canExecute(exe), "The driver is not executable: %s", exe.getAbsolutePath()); }
/** * Asserts whether given launcher exists, is a file and that it's executable. * * @param launcher the launcher to assert * @throws IOException if there is a problem with the provided launcher */ public static void assertLauncherGood(File launcher) throws IOException { if (!launcher.exists()) { throw new IOException("Unknown file: " + launcher.getPath()); } if (!launcher.isFile()) { throw new IOException("Not a real file: " + launcher.getPath()); } if (!FileHandler.canExecute(launcher)) { throw new IOException("Not executable: " + launcher.getPath()); } }