diff --git a/main/src/io/github/liplum/mindustry/SharedCache.kt b/main/src/io/github/liplum/mindustry/SharedCache.kt index 3586006..627950b 100644 --- a/main/src/io/github/liplum/mindustry/SharedCache.kt +++ b/main/src/io/github/liplum/mindustry/SharedCache.kt @@ -13,12 +13,17 @@ object SharedCache { } } - fun resolveCacheDir(): File { - return resolveGradleUserHome().resolve("mindustry-mgpp") - } + val cacheDir: File + get() = resolveGradleUserHome().resolve("mindustry-mgpp") + + val modsDir: File + get() = cacheDir.resolve("mods") + + val gamesDir: File + get() = cacheDir.resolve("games") fun cleanCache() { - val dir = resolveCacheDir() + val dir = cacheDir if (dir.isDirectory) { dir.deleteRecursively() } diff --git a/main/src/io/github/liplum/mindustry/task/DownloadGame.kt b/main/src/io/github/liplum/mindustry/task/DownloadGame.kt index 52e9c1d..da404cf 100644 --- a/main/src/io/github/liplum/mindustry/task/DownloadGame.kt +++ b/main/src/io/github/liplum/mindustry/task/DownloadGame.kt @@ -51,7 +51,7 @@ open class DownloadGame : DefaultTask() { // Download is a very expensive task, it should detect whether the file exists. if (gameLoc is GitHubGameLoc) { val downloadLoc = gameLoc.createDownloadLoc() - val cacheFile = SharedCache.resolveCacheDir().resolve("github").resolve(gameLoc.fileName).ensure() + val cacheFile = SharedCache.gamesDir.resolve("github").resolve(gameLoc.fileName).ensure() if (!cacheFile.exists()) { logger.lifecycle("Downloading $downloadLoc from ${gameLoc.fileName}...") try {