restructure tdelete

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1954 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2014-06-12 17:43:19 +00:00
parent 7a523a9ddb
commit c237f228a8
6 changed files with 26 additions and 26 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 1.0.14-9
Version: 1.0.14-10
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.1.11),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.19),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),mongoose

View File

@ -1,7 +1,7 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require lock system.class ts.class tdelete pretty_size browse.class \
require lock system.class ts.class pretty_size browse.class \
safe_delete settings.class plugin
set settings [settings]
@ -125,7 +125,7 @@ if {![file exists $tmp]} {
}
# Clean-up the temporary directory
foreach file [readdir -nocomplain $tmp] { tdelete "$tmp/$file" }
foreach file [readdir -nocomplain $tmp] { file tdelete "$tmp/$file" }
if {[system pkginst undelete]} {
set dustbin "[system dustbin]"
@ -357,7 +357,7 @@ proc do_decrypt {ts} {
}
}
} else {
tdelete "$rfile.encrypted"
file tdelete "$rfile.encrypted"
}
log "Done... [endclock $size]" 0
file delete $flagfile

View File

@ -55,11 +55,23 @@ proc {file touch} {target {ref ""}} {
}
}
proc {file tdelete} {target} {
if {[file isdirectory $target]} {
foreach f [readdir -nocomplain $target] {
file tdelete "$target/$f"
}
exec /mod/bin/busybox/rm -rf $target
} else {
exec /mod/bin/trm $target
}
}
local proc file {cmd args} {
switch $cmd {
"rename" { tailcall {file rename} {*}$args }
"copy" { tailcall {file copy} {*}$args }
"touch" { tailcall {file touch} {*}$args }
"tdelete" { tailcall {file tdelete} {*}$args }
default { tailcall upcall file $cmd {*}$args }
}
}

View File

@ -2,7 +2,7 @@
if {![exists -proc _del_bindir]} {
source /mod/webif/lib/setup
require ts.class system.class tdelete
require ts.class system.class
if {[system pkginst undelete]} {
set _del_dustbin [system dustbin]
@ -48,7 +48,7 @@ if {![exists -proc _del_bindir]} {
file rename $file $ndir
_del_touch $ndir
} else {
tdelete $file
file tdelete $file
}
return 1
}
@ -78,7 +78,7 @@ if {![exists -proc _del_bindir]} {
file rename $file $nfile
_del_touch $nfile
} else {
tdelete $file
file tdelete $file
}
catch {file delete "[file rootname $file].hmi"}
return 1

View File

@ -1,19 +1,7 @@
if {![exists -proc tdelete]} {
proc tdelete {path} {
if {[file isdirectory $path]} {
regsub -all {([\\["$])} $path {\\\1} cpath
foreach file [glob -nocomplain "${cpath}/*"] {
if {[file isdirectory $file]} {
tdelete $file
} else {
exec /mod/bin/trm $file
}
}
exec /mod/bin/busybox/rm -rf $path
} else {
exec /mod/bin/trm $path
}
}
# Deprecated - just use {file tdelete}
if {![exists -alias tdelete]} {
alias tdelete {file tdelete}
}

View File

@ -2,7 +2,7 @@
if {![exists -proc class]} { package require oo }
if {![exists -proc pack]} { package require pack }
source /mod/webif/lib/setup
require tdelete system.class
require system.class
set dmsfile /mnt/hd2/dms_cds.db
@ -164,7 +164,7 @@ proc {ts fetch} {file {checked 0}} {
ts method delete {} {
foreach f [$self fileset] {
tdelete $f
file tdelete $f
puts "Removed $f<br>"
}
return 1
@ -287,7 +287,7 @@ ts method mkthm {{offset 0}} {
}
exec /bin/echo -n " " >> $bfile.thm~
file rename -force $bfile.thm~ $bfile.thm
tdelete $bfile.bmp
file tdelete $bfile.bmp
return 1
}