File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -24,20 +24,32 @@ private ASP3EngineFS(String rootDirectory,
2424 public static ASP3ChunkStorage getASP3ChunkStorage (String owner , String rootDirectory )
2525 throws IOException , ASP3Exception {
2626
27+ // check if root directory already exists. If not srt it up
28+ File root = new File (rootDirectory );
29+ if (!root .exists ()) {
30+ root .mkdirs ();
31+ }
32+
2733 return ASP3EngineFS .getASP3Engine (owner , rootDirectory , null );
2834
2935 }
3036
3137 public static ASP3ChunkStorage getASP3ChunkStorage (String rootDirectory )
3238 throws IOException , ASP3Exception {
3339
34- return ASP3EngineFS .getASP3Engine (ASP3EngineFS .DEFAULT_OWNER , rootDirectory , null );
40+ return ASP3EngineFS .getASP3ChunkStorage (ASP3EngineFS .DEFAULT_OWNER , rootDirectory );
3541
3642 }
3743
3844 public static ASP3Engine getASP3Engine (String owner , String rootDirectory ,
3945 ASP3Reader reader ) throws IOException , ASP3Exception {
4046
47+ // root directory must exist when setting up an engine
48+ File root = new File (rootDirectory );
49+ if (!root .exists () || !root .isDirectory ()) {
50+ throw new ASP3Exception ("chunk root directory must exist when creating an ASP3Engine" );
51+ }
52+
4153 ASP3EngineFS engine = new ASP3EngineFS (
4254 rootDirectory ,
4355 new ASP3StorageFS (rootDirectory ),
You can’t perform that action at this time.
0 commit comments