diff --git a/webif/html/browse/index.jim b/webif/html/browse/index.jim index a1b60be..d10aa01 100755 --- a/webif/html/browse/index.jim +++ b/webif/html/browse/index.jim @@ -292,7 +292,7 @@ if {$parent ne ""} { " } -proc s_time {a b} { +proc s_file_stat {a b attr} { global dir set a "$dir/$a" @@ -310,40 +310,21 @@ proc s_time {a b} { } if {[catch {file stat $a l}]} { return 0} - set at $l(mtime) + set at $l($attr) if {[catch {file stat $b l}]} { return 0} - set bt $l(mtime) + set bt $l($attr) if {$at < $bt} { return -1 } if {$at > $bt} { return 1 } return 0 } +proc s_time {a b} { + tailcall s_file_stat $a $b mtime +} + proc s_size {a b} { - global dir - - set a "$dir/$a" - set b "$dir/$b" - - set ad [file isdirectory $a] - set bd [file isdirectory $b] - - if {$ad && !$bd} { return -1 } - if {$bd && !$ad} { return 1 } - if {$ad && $bd} { - if {$a < $b} { return -1 } - if {$a > $b} { return 1 } - return 0 - } - - if {[catch {file stat $a l}]} { return 0} - set as $l(size) - if {[catch {file stat $b l}]} { return 0} - set bs $l(size) - - if {$as < $bs} { return -1 } - if {$as > $bs} { return 1 } - return 0 + tailcall s_file_stat $a $b size } set files [readdir -nocomplain $dir] @@ -367,26 +348,27 @@ Directories: $dircount, Files: $filecount # Sort icons puts "