KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > prevayler > foundation > FileManager


1 //Prevayler(TM) - The Free-Software Prevalence Layer.
2
//Copyright (C) 2001 Klaus Wuestefeld
3
//This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4

5 package org.prevayler.foundation;
6
7 import java.io.*;
8
9 public class FileManager {
10
11     static public File produceDirectory(String JavaDoc directoryName) throws IOException {
12         File directory = new File(directoryName);
13         if (!directory.exists() && !directory.mkdirs()) throw new IOException("Directory doesn't exist and could not be created: " + directoryName);
14         if (!directory.isDirectory()) throw new IOException("Path exists but is not a directory: " + directoryName);
15         return directory;
16     }
17 }
18
Popular Tags