file rename
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1422 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
dae5f9394b
commit
d466b5cc15
21
var/mongoose/lib/filerename
Normal file
21
var/mongoose/lib/filerename
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
proc {file rename} {{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/mv $source $target
|
||||||
|
} on error {msg opts} {
|
||||||
|
incr opts(-level)
|
||||||
|
return {*}$opts $msg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -45,5 +45,9 @@ if {![exists -proc require]} {
|
|||||||
# largefile safe.
|
# largefile safe.
|
||||||
|
|
||||||
require filecopy
|
require filecopy
|
||||||
|
|
||||||
|
# and {file rename} with one that supports cross-filesystem moves.
|
||||||
|
|
||||||
|
require filerename
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user