forked from hummypkg/webif
22 lines
458 B
Plaintext
22 lines
458 B
Plaintext
|
|
||
|
proc {file copy} {{force {}} source target} {
|
||
|
try {
|
||
|
if {$force ni {{} -force}} {
|
||
|
error "bad option \"$force\": should be -force"
|
||
|
}
|
||
|
|
||
|
if {![file exists $source]} {
|
||
|
error "source file does not exist."
|
||
|
}
|
||
|
|
||
|
if {$force eq "" && [file exists $target]} {
|
||
|
error "error copying \"$source\" to \"$target\": file already exists"
|
||
|
}
|
||
|
exec /mod/bin/busybox/cp $source $target
|
||
|
} on error {msg opts} {
|
||
|
incr opts(-level)
|
||
|
return {*}$opts $msg
|
||
|
}
|
||
|
}
|
||
|
|