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 return $dir
} }
# Handle deletions from the bin.
if {[string first $dustbin $file] > -1} { set dustbin "" }
if {$type eq "ts"} { if {$type eq "ts"} {
set ts [ts fetch $file] set ts [ts fetch $file]
if {$dustbin ne ""} { if {$dustbin ne ""} {

View File

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

View File

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