Added newFile(base, part, part, ...).

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2640 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2009-09-29 23:41:06 +00:00
parent f6c34ddf91
commit 46b8db852c
@@ -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:
* <code>fromPath(new File("dir"), "subdir", "anotherdir", "file.txt")</code> creates a file
* with the Unix path <code>dir/subdir/anotherdir/file.txt</code>.
*/
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.