summaryrefslogtreecommitdiffstats
path: root/library/init.tcl
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-12-09 00:11:54 (GMT)
committerhobbs <hobbs>2000-12-09 00:11:54 (GMT)
commit2d55e96489ed66550e1a990c249d3c6beeb93e4b (patch)
tree78df4c68f099bab4f53f99244ba41bd79f308d4f /library/init.tcl
parent68fa236d8e2326157a6024efdfba2ca00a803c7a (diff)
downloadtcl-2d55e96489ed66550e1a990c249d3c6beeb93e4b.zip
tcl-2d55e96489ed66550e1a990c249d3c6beeb93e4b.tar.gz
tcl-2d55e96489ed66550e1a990c249d3c6beeb93e4b.tar.bz2
* library/init.tcl: Added support for PATHEXT variable in
auto_execok, recognizing the proper set of executable extensions on Windows. [Patch #102719]
Diffstat (limited to 'library/init.tcl')
-rw-r--r--library/init.tcl12
1 files changed, 9 insertions, 3 deletions
diff --git a/library/init.tcl b/library/init.tcl
index 426d651..865db47 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -3,7 +3,7 @@
# Default system startup file for Tcl-based applications. Defines
# "unknown" procedure and auto-load facilities.
#
-# RCS: @(#) $Id: init.tcl,v 1.42 2000/11/23 14:21:59 dkf Exp $
+# RCS: @(#) $Id: init.tcl,v 1.43 2000/12/09 00:11:54 hobbs Exp $
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -509,13 +509,19 @@ proc auto_execok name {
# NT includes the 'start' built-in
lappend shellBuiltins "start"
}
+ if {[info exists env(PATHEXT)]} {
+ # Add an initial ; to have the {} extension check first.
+ set execExtensions [split ";$env(PATHEXT)" ";"]
+ } else {
+ set execExtensions [list {} .com .exe .bat]
+ }
if {[lsearch -exact $shellBuiltins $name] != -1} {
return [set auto_execs($name) [list $env(COMSPEC) /c $name]]
}
if {[llength [file split $name]] != 1} {
- foreach ext {{} .com .exe .bat} {
+ foreach ext $execExtensions {
set file ${name}${ext}
if {[file exists $file] && ![file isdirectory $file]} {
return [set auto_execs($name) [list $file]]
@@ -545,7 +551,7 @@ proc auto_execok name {
# Skip already checked directories
if {[info exists checked($dir)] || [string equal {} $dir]} { continue }
set checked($dir) {}
- foreach ext {{} .com .exe .bat} {
+ foreach ext $execExtensions {
set file [file join $dir ${name}${ext}]
if {[file exists $file] && ![file isdirectory $file]} {
return [set auto_execs($name) [list $file]]