public static SortedSet<CueballFilePath> getDeltas(String... dirs) throws IOException { SortedSet<CueballFilePath> result = new TreeSet<CueballFilePath>(); Set<String> paths = FsUtils.getMatchingPaths(DELTA_REGEX, dirs); for (String path : paths) { result.add(new CueballFilePath(path)); } return result; }
public static String fileToString(String fileName) { if (fileName == null || StringUtils.isBlank(fileName)) { return ""; } File file = new File(fileName); String content = ""; try { content = FsUtils.readFileToString(file); } catch (IOException e) { System.err.println(e.toString()); System.exit(1); } return content; } }
public static void rmrf(String dir) { File d = new File(dir); if (d.exists()) { if (d.isDirectory()) { for (String x : d.list()) { rmrf(dir + "/" + x); } } if (!d.delete()) { throw new RuntimeException("tried to delete " + dir + " but failed!"); } } }
public static SortedSet<CurlyFilePath> getBases(String... dirs) throws IOException { SortedSet<CurlyFilePath> result = new TreeSet<CurlyFilePath>(); Set<String> paths = FsUtils.getMatchingPaths(BASE_REGEX, dirs); for (String path : paths) { result.add(new CurlyFilePath(path)); } return result; }
@Before public final void setUpBase() throws Exception { FsUtils.rmrf(localTmpDir); new File(localTmpDir).mkdirs(); }
public static SortedSet<CurlyFilePath> getDeltas(String... dirs) throws IOException { SortedSet<CurlyFilePath> result = new TreeSet<CurlyFilePath>(); Set<String> paths = FsUtils.getMatchingPaths(DELTA_REGEX, dirs); for (String path : paths) { result.add(new CurlyFilePath(path)); } return result; }
public static SortedSet<CueballFilePath> getBases(String... dirs) throws IOException { SortedSet<CueballFilePath> result = new TreeSet<CueballFilePath>(); Set<String> paths = FsUtils.getMatchingPaths(BASE_REGEX, dirs); for (String path : paths) { result.add(new CueballFilePath(path)); } return result; }