Skip to content

Commit dbb16d9

Browse files
committed
Allow kscript cache dir to be configurable (fixes #146)
1 parent 2d1ed0b commit dbb16d9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/kotlin/kscript/app/Kscript.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ Website : https://github.com/holgerbrandl/kscript
5252
""".trim()
5353

5454
// see https://stackoverflow.com/questions/585534/what-is-the-best-way-to-find-the-users-home-directory-in-java
55-
val KSCRIPT_CACHE_DIR = File(System.getProperty("user.home")!!, ".kscript")
55+
// See #146 "allow kscript cache dir to be configurable" for details
56+
val KSCRIPT_CACHE_DIR = System.getenv("KSCRIPT_CACHE_DIR")?.let { File(it) }
57+
?: File(System.getProperty("user.home")!!, ".kscript")
5658

5759
// use lazy here prevent empty dirs for regular scripts https://github.com/holgerbrandl/kscript/issues/130
5860
val SCRIPT_TEMP_DIR by lazy { createTempDir() }

0 commit comments

Comments
 (0)