forked from hummypkg/webif
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:
parent
602f96e1ac
commit
3d75b93f1a
@ -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 ""} {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user