Skip to content

Commit 138cf66

Browse files
committed
fix unit test that cannot get cache folder in test env
1 parent 992fe38 commit 138cf66

File tree

1 file changed

+11
-4
lines changed
  • src/main/java/org/maxgamer/quickshop/util

1 file changed

+11
-4
lines changed

src/main/java/org/maxgamer/quickshop/util/Util.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,11 +1206,18 @@ public static boolean fireCancellableEvent(@NotNull Cancellable event) {
12061206
* @return The caching folder
12071207
*/
12081208
public static File getCacheFolder() {
1209-
File cache = new File(QuickShop.getInstance().getDataFolder(), "cache");
1210-
if (!cache.exists()) {
1211-
cache.mkdirs();
1209+
QuickShop qs = QuickShop.getInstance();
1210+
if (qs != null) {
1211+
File cache = new File(QuickShop.getInstance().getDataFolder(), "cache");
1212+
if (!cache.exists()) {
1213+
cache.mkdirs();
1214+
}
1215+
return cache;
1216+
} else {
1217+
File file = new File("cache");
1218+
file.mkdirs();
1219+
return file;
12121220
}
1213-
return cache;
12141221
}
12151222

12161223
/**

0 commit comments

Comments
 (0)