From 2d55e96489ed66550e1a990c249d3c6beeb93e4b Mon Sep 17 00:00:00 2001 From: hobbs Date: Sat, 9 Dec 2000 00:11:54 +0000 Subject: * library/init.tcl: Added support for PATHEXT variable in auto_execok, recognizing the proper set of executable extensions on Windows. [Patch #102719] --- ChangeLog | 6 ++++++ library/init.tcl | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 13b827a..e9bea7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-12-08 jeff hobbs + + * library/init.tcl: Added support for PATHEXT variable in + auto_execok, recognizing the proper set of executable extensions + on Windows. [Patch #102719] + 2000-12-08 Andreas Kupries * generic/tclEncoding.c (LoadTableEncoding): Changed dangerous 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]] -- cgit v0.12