Skip to content

Commit

Permalink
fixed major bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ErrorxCode committed Mar 19, 2023
1 parent ef6c5be commit 4377ecd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Clorine/src/main/java/com/errorxcode/clorine/Clorine.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ public class Clorine {
*/
public static Cache createOrOpen(int capacity,String name,File directory){
var cacheDir = new File(directory,name);
try {
cacheDir.createNewFile();
if (cacheDir.mkdir())
return new Cache(capacity,cacheDir);
} catch (IOException e) {
throw new RuntimeException(e);
}
else
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");
}

/**
* Delete a cache
* @param name the name of the cache
Expand All @@ -33,4 +31,4 @@ public static Cache createOrOpen(int capacity,String name,File directory){
public static void delete(String name,File directory){
new File(directory,name).delete();
}
}
}

0 comments on commit 4377ecd

Please sign in to comment.