aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2024-10-25 15:39:26 +1000
committerSteve Bennett <steveb@workware.net.au>2024-10-27 11:19:15 +1000
commit8bae61803cb92b5a834b168e686cfb300ba54296 (patch)
treeef8df2a98cc3f7e5bccb70eea1d0aea406eec92c
parent74b223e60cb06c1f0211e019a8dc37a3a274b6eb (diff)
downloadjimtcl-8bae61803cb92b5a834b168e686cfb300ba54296.zip
jimtcl-8bae61803cb92b5a834b168e686cfb300ba54296.tar.gz
jimtcl-8bae61803cb92b5a834b168e686cfb300ba54296.tar.bz2
initjimsh: on Windows the current dir is searched first
Before the PATH Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--initjimsh.tcl10
1 files changed, 8 insertions, 2 deletions
diff --git a/initjimsh.tcl b/initjimsh.tcl
index 6fa54c6..e632623 100644
--- a/initjimsh.tcl
+++ b/initjimsh.tcl
@@ -10,8 +10,14 @@ proc _jimsh_init {} {
if {[string match "*/*" $jim::argv0]} {
set jim::exe [file join [pwd] $jim::argv0]
} else {
- foreach path [split [env PATH ""] $tcl_platform(pathSeparator)] {
- set exec [file join [pwd] [string map {\\ /} $path] $jim::argv0]
+ set jim::argv0 [file tail $jim::argv0]
+ set path [split [env PATH ""] $tcl_platform(pathSeparator)]
+ if {$tcl_platform(platform) eq "windows"} {
+ # Windows searches the current directory first, and convert backslashes to slashes
+ set path [lmap p [list "" {*}$path] { string map {\\ /} $p }]
+ }
+ foreach p $path {
+ set exec [file join [pwd] $p $jim::argv0]
if {[file executable $exec]} {
set jim::exe $exec
break