Skip to content

Commit 18d733f

Browse files
authored
Fix calling kscript.bat by symlink and PowerShell compatibility (#390)
* Fix calling kscript.bat by symlink * Use short name of the bin dir in kscript.bat
1 parent 6da00b1 commit 18d733f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/kscript.bat

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ if !_java_major_version! geq 9 (
4545
set JAVA_OPTS=!JAVA_OPTS! "--add-opens" "java.base/java.util=ALL-UNNAMED"
4646
)
4747

48-
for /f "tokens=* USEBACKQ" %%o in (`where kscript.bat`) do set ABS_KSCRIPT_PATH=%%o
49-
set CLASS_PATH=%ABS_KSCRIPT_PATH:~0,-16%\bin\*
48+
set CLASS_PATH=%_BIN_DIR%\*
5049

5150
java !JAVA_OPTS! -classpath %CLASS_PATH% io.github.kscripting.kscript.KscriptKt windows %KOTLIN_OPTS%
5251

@@ -56,8 +55,7 @@ rem ##########################################################################
5655
rem # subroutines
5756

5857
:set_home
59-
set _BIN_DIR=
60-
for %%i in (%~sf0) do set _BIN_DIR=%_BIN_DIR%%%~dpsi
58+
set _BIN_DIR=%~dps0
6159
set _KOTLIN_HOME=%_BIN_DIR%..
6260
goto :eof
6361

0 commit comments

Comments
 (0)