Skip to content

Commit 689a6bf

Browse files
hj-leeholgerbrandl
authored andcommitted
Support "~" in INCLUDE (#185)
1 parent 9be3ecd commit 689a6bf

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ fun resolveIncludes(template: File, includeContext: URI = template.parentFile.to
3535
val includeURL = when {
3636
isUrl(include) -> URL(include)
3737
include.startsWith("/") -> File(include).toURI().toURL()
38+
include.startsWith("~/") -> File(System.getenv("HOME")!! + include.substring(1)).toURI().toURL()
3839
else -> includeContext.resolve(URI(include.removePrefix("./"))).toURL()
3940
}
4041

0 commit comments

Comments
 (0)