shared items

Friday, September 5, 2008

check dir or create it

protected void checkDir(File dir) throws IOException
{
if (!dir.exists())
dir.mkdir();
if (!dir.isDirectory() )
throw new IOException("Working dir specified is not a directory");
if (!dir.canWrite())
throw new IOException("Working dir is not writable");

}

No comments: