Skip to content

Commit faa5388

Browse files
rossbacherAndreas Rossbacher
andauthored
Use absolute paths to avoid issues with relative paths and relativize (#285)
Co-authored-by: Andreas Rossbacher <[email protected]>
1 parent 44e7225 commit faa5388

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,15 @@ $kotlinOptions
320320

321321
// https://stackoverflow.com/questions/17926459/creating-a-symbolic-link-with-java
322322
createSymLink(File(this, scriptFile.name), scriptFile)
323-
val scriptDir = Paths.get(scriptFile.path).parent
323+
val scriptDir = Paths.get(scriptFile.absolutePath).parent
324324

325325
// also symlink all includes
326326
includeURLs.distinctBy { it.fileName() }
327327
.forEach {
328328
val symlinkSrcDirAndDestination = when {
329329
it.protocol == "file" -> {
330330
val includeFile = File(it.toURI())
331-
val includeDir = Paths.get(includeFile.path).parent
331+
val includeDir = Paths.get(includeFile.absolutePath).parent
332332
val symlinkRelativePathToScript = File(this, scriptDir.relativize(includeDir).toFile().path)
333333
symlinkRelativePathToScript.mkdirs()
334334
Pair(symlinkRelativePathToScript, includeFile)

0 commit comments

Comments
 (0)