import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
}
private static void createDirectory(File path) throws IOException {
- if (path.exists() && !path.isDirectory())
- throw new IOException("Could not create index directory " + path + ", a file by that name already exists");
- path.mkdirs();
- if (!path.exists())
- throw new IOException("Could not create index directory " + path + " for an unknown reason");
- if (!path.isDirectory())
+ Path p = path.toPath();
+ if (Files.exists(p) && !Files.isDirectory(p))
throw new IOException("Could not create index directory " + path + ", a file by that name already exists");
+ Files.createDirectories(p);
}
File getIndexPath() {