/** * Creates a temp file with delete on exit rule. The extension is extracted from the template if * possible, else the default extension is used. The contents of template will be copied into * the temporary file. * * @param template file path to copy from and define file extension * @param defaultExtension file extension if no is contained in template * @return newly created and filled temporary file * @throws IOException if an I/O error occurred */ public static File copyToTempFile(String template, String defaultExtension) throws IOException { return copyToTempFile(new File(template), defaultExtension); }
try tmpFile = IoHelper.copyToTempFile(action.getBuildFile(), ".xml"); try propFile = IoHelper.copyToTempFile(propName, ".properties"); newProps.add(propFile.getCanonicalPath());