1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Fix the new tool/cp.tcl so that it works with older TCL versions, such as

jimtcl.

FossilOrigin-Name: 61f18c96183867fe9d0fb30b8b71c0253f40503e32c8a4202196fb6418f2f46e
This commit is contained in:
drh
2024-10-24 15:57:21 +00:00
parent 4f237f8def
commit ae5ef1e80f
3 changed files with 27 additions and 8 deletions

View File

@ -6,4 +6,23 @@
#
# tclsh cp.tcl FILE1 FILE2 ... FILEN DIR
#
file copy -force -- {*}$argv
# This should be as simple as
#
# file copy -force -- {*}$argv
#
# But jimtcl doesn't support that. So we have to do it the hard way.
if {[llength $argv]<2} {
error "Usage: $argv0 SRC... DESTDIR"
}
set n [llength $argv]
set destdir [lindex $argv [expr {$n-1}]]
if {![file isdir $destdir]} {
error "$argv0: not a directory: \"$destdir\""
}
for {set i 0} {$i<$n-1} {incr i} {
set fn [file normalize [lindex $argv $i]]
set tail [file tail $fn]
file copy -force $fn [file normalize $destdir/$tail]
}