summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--library/auto.tcl15
-rw-r--r--tests/autoMkindex.test13
2 files changed, 24 insertions, 4 deletions
diff --git a/library/auto.tcl b/library/auto.tcl
index 2a035fd..ddb317b 100644
--- a/library/auto.tcl
+++ b/library/auto.tcl
@@ -3,7 +3,7 @@
# utility procs formerly in init.tcl dealing with auto execution
# of commands and can be auto loaded themselves.
#
-# RCS: @(#) $Id: auto.tcl,v 1.3 1999/08/19 02:59:40 hobbs Exp $
+# RCS: @(#) $Id: auto.tcl,v 1.4 2000/01/28 00:09:15 ericm Exp $
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
@@ -479,8 +479,13 @@ proc auto_mkindex_parser::fullname {name} {
auto_mkindex_parser::command proc {name args} {
variable index
variable scriptFile
+ # Do some fancy reformatting on the "source" call to handle platform
+ # differences with respect to pathnames. Use format just so that the
+ # command is a little easier to read (otherwise it'd be full of
+ # backslashed dollar signs, etc.
append index [list set auto_index([fullname $name])] \
- " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
+ [format { [list source [file join $dir %s]]} \
+ [file split $scriptFile]] "\n"
}
# Conditionally add support for Tcl byte code files. There are some
@@ -506,8 +511,12 @@ auto_mkindex_parser::hook {
auto_mkindex_parser::commandInit tbcload::bcproc {name args} {
variable index
variable scriptFile
+ # Do some nice reformatting of the "source" call, to get around
+ # path differences on different platforms. We use the format
+ # command just so that the code is a little easier to read.
append index [list set auto_index([fullname $name])] \
- " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
+ [format { [list source [file join $dir %s]]} \
+ [file split $scriptFile]] "\n"
}
}
}
diff --git a/tests/autoMkindex.test b/tests/autoMkindex.test
index 27de741..cdc33d3 100644
--- a/tests/autoMkindex.test
+++ b/tests/autoMkindex.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: autoMkindex.test,v 1.7 1999/10/19 18:08:44 jenn Exp $
+# RCS: @(#) $Id: autoMkindex.test,v 1.8 2000/01/28 00:09:15 ericm Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -176,6 +176,17 @@ test autoMkindex-3.3 {auto_mkindex_parser::command} {knownBug} {
list [lvalue $::result *mycmd4*] [lvalue $::result *mycmd5*] [lvalue $::result *mycmd6*]
} "{::buried::mycmd4 $element} {::buried::mycmd5 $element} {mycmd6 $element}"
+test autoMkindex-4.1 {platform indenpendant source commands} {
+ file delete tclIndex
+ auto_mkindex . pkg/samename.tcl
+ set f [open tclIndex r]
+ set dat [split [string trim [read $f]] "\n"]
+ set len [llength $dat]
+ set result [lsort [lrange $dat [expr {$len-2}] [expr {$len-1}]]]
+ close $f
+ set result
+} {{set auto_index(::college::team) [list source [file join $dir pkg samename.tcl]]} {set auto_index(::pro::team) [list source [file join $dir pkg samename.tcl]]}}
+
# Clean up.
unset result