summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>1999-08-09 16:30:50 (GMT)
committerhobbs <hobbs>1999-08-09 16:30:50 (GMT)
commit724a8328fb6bd52c285587e77584ca778ce40836 (patch)
treee3641e9d08506ccd295fe3c83726a06846f9867c
parentc6cad9a80c362fb16803329eb1f55bf319d0c628 (diff)
downloadtcl-724a8328fb6bd52c285587e77584ca778ce40836.zip
tcl-724a8328fb6bd52c285587e77584ca778ce40836.tar.gz
tcl-724a8328fb6bd52c285587e77584ca778ce40836.tar.bz2
1999-08-09 Jeff Hobbs <hobbs@scriptics.com>
* library/init.tcl: fixed path handling in auto_execok (it could miss including the normal path on some Windows machines) [Bug: 1276]
-rw-r--r--library/init.tcl18
1 files changed, 10 insertions, 8 deletions
diff --git a/library/init.tcl b/library/init.tcl
index ad092cc..7287398 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.31 1999/06/25 23:29:53 welch Exp $
+# RCS: @(#) $Id: init.tcl,v 1.32 1999/08/09 16:30:50 hobbs Exp $
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -223,7 +223,7 @@ proc unknown args {
&& [info exists tcl_interactive] && $tcl_interactive} {
if {![info exists auto_noexec]} {
set new [auto_execok $name]
- if {$new != ""} {
+ if {[string compare {} $new]} {
set errorCode $savedErrorCode
set errorInfo $savedErrorInfo
set redir ""
@@ -480,7 +480,7 @@ proc auto_import {pattern} {
# Arguments:
# name - Name of a command.
-if {[string compare $tcl_platform(platform) windows] == 0} {
+if {[string equal windows $tcl_platform(platform)]} {
# Windows version.
#
# Note that info executable doesn't work under Windows, so we have to
@@ -522,14 +522,16 @@ proc auto_execok name {
append path "$windir/system;$windir;"
}
- if {[info exists env(PATH)]} {
- append path $env(PATH)
+ foreach var {PATH Path path} {
+ if {[info exists env($var)]} {
+ append path ";$env($var)"
+ }
}
foreach dir [split $path {;}] {
- if {$dir == ""} {
- set dir .
- }
+ # Skip already checked directories
+ if {[info exists checked($dir)] || [string equal {} $dir]} { continue }
+ set checked($dir) {}
foreach ext {{} .com .exe .bat} {
set file [file join $dir ${name}${ext}]
if {[file exists $file] && ![file isdirectory $file]} {