allow deletions from inside dustbin

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@666 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2012-01-14 00:29:44 +00:00
parent 602f96e1ac
commit 3d75b93f1a
3 changed files with 15 additions and 6 deletions

View File

@ -27,6 +27,9 @@ proc bindir {file} {
return $dir
}
# Handle deletions from the bin.
if {[string first $dustbin $file] > -1} { set dustbin "" }
if {$type eq "ts"} {
set ts [ts fetch $file]
if {$dustbin ne ""} {

View File

@ -37,9 +37,15 @@ foreach file [cgi_get files] {
continue
}
if {[string first $dustbin $file] > -1} {
set ldustbin ""
} else {
set ldustbin $dustbin
}
if {[file isdirectory $file]} {
puts -nonewline "Directory..."
if {$dustbin ne ""} {
if {$ldustbin ne ""} {
set ndir "[bindir $file]/[file tail $file]"
while {[file isdirectory $ndir]} { append ndir "_" }
file rename $file $ndir
@ -49,7 +55,7 @@ foreach file [cgi_get files] {
puts -nonewline "Done..."
} elseif {[string match {*.ts} $file]} {
set ts [ts fetch $file]
if {$dustbin ne ""} {
if {$ldustbin ne ""} {
$ts move [bindir $file]
} else {
if {[$ts delete]} {
@ -59,7 +65,7 @@ foreach file [cgi_get files] {
}
}
} else {
if {$dustbin ne ""} {
if {$ldustbin ne ""} {
file rename $file "[bindir $file]/[file tail $file]"
} else {
tdelete $file

View File

@ -2,10 +2,10 @@
if {![exists -proc tdelete]} {
proc tdelete {path} {
if {[file isdirectory $path]} {
regsub -all {([\\["$])} $path {\\\1} path
foreach file [glob -nocomplain "${path}/*"] {
regsub -all {([\\["$])} $path {\\\1} cpath
foreach file [glob -nocomplain "${cpath}/*"] {
if {[file isdirectory $file]} {
system tdelete $file
tdelete $file
} else {
exec /mod/bin/trm $file
}