List of usage examples for org.apache.commons.io IOCase checkEndsWith
public boolean checkEndsWith(String str, String end)
From source file:org.eclipse.smila.utils.scriptexecution.WindowsScriptExecutor.java
/** * {@inheritDoc}/*from ww w. jav a 2 s. c o m*/ */ public int execute(final File file) throws IOException, InterruptedException { _log.debug("Executing " + file.getAbsolutePath()); final String fileName = file.getName(); final IOCase ioCase = IOCase.SYSTEM; if (!ioCase.checkEndsWith(fileName, ".cmd") && !ioCase.checkEndsWith(fileName, ".bat")) { _log.debug("It doesn't end with .cmd or .bat"); final File tempFile = getTempCmdFile(file.getParentFile()); try { _log.debug("Copy " + file.getAbsolutePath() + " to " + tempFile); FileUtils.copyFile(file, tempFile); return doExecute(tempFile); } finally { tempFile.delete(); } } else { return doExecute(file); } }