protected void copyModel(File sourceDir, File profileDir) throws IOException { if (sourceDir == null || !sourceDir.exists()) { return; } FileHandler.copy(sourceDir, profileDir); }
// TODO(simon): Replace me public static void copyDirectory(File source, File dest) { try { FileHandler.copy(source, dest); } catch (IOException e) { throw Throwables.propagate(e); } }
/** * Copies all files matching the suffix to the destination directory. * * <p>If no files match, and the destination directory did not already exist, the destination * directory is still created, if possible. * * @param source the source directory * @param suffix the suffix for all files to be copied. * @param dest the destination directory */ protected static boolean copyDirectory(File source, String suffix, File dest) { try { FileHandler.copy(source, dest, suffix); return true; } catch (IOException e) { return false; } }
// TODO(simon): Replace me public static void copySingleFileWithOverwrite( File sourceFile, File destFile, boolean overwrite) { // Ensure that the source is actually a file if (!sourceFile.exists()) { throw new RuntimeException("Source file does not exist: " + sourceFile); } if (!sourceFile.isFile()) { throw new RuntimeException("Source is not a single file: " + sourceFile); } if (!overwrite && destFile.exists()) { throw new RuntimeException("Destination file already exists: " + destFile); } try { FileHandler.copy(sourceFile, destFile); } catch (IOException e) { throw Throwables.propagate(e); } }