diff options
author | vincentdarley <vincentdarley> | 2001-11-04 17:59:48 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2001-11-04 17:59:48 (GMT) |
commit | 724c015bc9598656596b14ead4f67496cb0e72dd (patch) | |
tree | d89c849c745946899ac0ff5c2a8175e06766620d /library/init.tcl | |
parent | 194b57cf7965f1a5ae122835392cca76dcbcb99c (diff) | |
download | tcl-724c015bc9598656596b14ead4f67496cb0e72dd.zip tcl-724c015bc9598656596b14ead4f67496cb0e72dd.tar.gz tcl-724c015bc9598656596b14ead4f67496cb0e72dd.tar.bz2 |
vfs robustness fix
Diffstat (limited to 'library/init.tcl')
-rw-r--r-- | library/init.tcl | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/library/init.tcl b/library/init.tcl index 5f7e58f..4802683 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.49 2001/07/31 19:12:07 vincentdarley Exp $ +# RCS: @(#) $Id: init.tcl,v 1.50 2001/11/04 17:59:48 vincentdarley Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -647,7 +647,8 @@ proc ::tcl::CopyDirectory {action src dest} { set nsrc [file normalize $src] set ndest [file normalize $dest] if {[string equal $action "renaming"]} { - # Can't rename volumes + # Can't rename volumes. We could give a more precise + # error message here, but that would break the test suite. if {[lsearch -exact [file volumes] $nsrc] != -1} { return -code error "error $action \"$src\" to\ \"$dest\": trying to rename a volume or move a directory\ @@ -690,15 +691,16 @@ proc ::tcl::CopyDirectory {action src dest} { } file mkdir $dest } - # Have to be careful to capture both visible and hidden files - foreach s [glob -nocomplain -directory $src *] { - if {([file tail $s] != ".") && ([file tail $s] != "..")} { - file copy $s [file join $dest [file tail $s]] - } - } - # This will pick up things beginning with '.' on Unix and on - # Windows/MacOS those files which the OS considers invisible. - foreach s [glob -nocomplain -directory $src -types hidden *] { + # Have to be careful to capture both visible and hidden files. + # We will also be more generous to the file system and not + # assume the hidden and non-hidden lists are non-overlapping. + # + # On Unix 'hidden' files begin with '.'. On other platforms + # or filesystems hidden files may have other interpretations. + set filelist [concat [glob -nocomplain -directory $src *] \ + [glob -nocomplain -directory $src -types hidden *]] + + foreach s [lsort -unique $filelist] { if {([file tail $s] != ".") && ([file tail $s] != "..")} { file copy $s [file join $dest [file tail $s]] } |