Skip to content

Commit 4377ecd

Browse files
authored
fixed major bug
1 parent ef6c5be commit 4377ecd

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

Clorine/src/main/java/com/errorxcode/clorine/Clorine.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ public class Clorine {
1717
*/
1818
public static Cache createOrOpen(int capacity,String name,File directory){
1919
var cacheDir = new File(directory,name);
20-
try {
21-
cacheDir.createNewFile();
20+
if (cacheDir.mkdir())
2221
return new Cache(capacity,cacheDir);
23-
} catch (IOException e) {
24-
throw new RuntimeException(e);
25-
}
22+
else
23+
throw new RuntimeException("You might have already created a cache with this name or do not have permission to create a cache in this directory");
2624
}
27-
25+
2826
/**
2927
* Delete a cache
3028
* @param name the name of the cache
@@ -33,4 +31,4 @@ public static Cache createOrOpen(int capacity,String name,File directory){
3331
public static void delete(String name,File directory){
3432
new File(directory,name).delete();
3533
}
36-
}
34+
}

0 commit comments

Comments
 (0)