diff --git a/src/java/com/samskivert/util/FileUtil.java b/src/java/com/samskivert/util/FileUtil.java index bb0f4c68..160ec3fb 100644 --- a/src/java/com/samskivert/util/FileUtil.java +++ b/src/java/com/samskivert/util/FileUtil.java @@ -38,6 +38,20 @@ import static com.samskivert.Log.log; */ public class FileUtil { + /** + * Creates a file from the supplied root using the specified child components. For example: + * fromPath(new File("dir"), "subdir", "anotherdir", "file.txt") creates a file + * with the Unix path dir/subdir/anotherdir/file.txt. + */ + public static File newFile (File root, String... parts) + { + File path = root; + for (String part : parts) { + path = new File(path, part); + } + return path; + } + /** * Recursively delete the specified directory and all files and * directories underneath it.