filesize of -1 for directories for proper sorting
maybe actually count directory size someday but then a new column would have to be added
This commit is contained in:
parent
e0ffb8502c
commit
af2af0c587
|
@ -23,8 +23,13 @@ type DiskFile struct {
|
||||||
func (f DiskFile) Name() string { return f.name }
|
func (f DiskFile) Name() string { return f.name }
|
||||||
func (f DiskFile) Path() string { return filepath.Join(f.path, f.name) }
|
func (f DiskFile) Path() string { return filepath.Join(f.path, f.name) }
|
||||||
func (f DiskFile) Date() time.Time { return f.modified }
|
func (f DiskFile) Date() time.Time { return f.modified }
|
||||||
func (f DiskFile) Filesize() int64 { return f.filesize }
|
|
||||||
func (f DiskFile) IsDir() bool { return f.isdir }
|
func (f DiskFile) IsDir() bool { return f.isdir }
|
||||||
|
func (f DiskFile) Filesize() int64 {
|
||||||
|
if f.isdir {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
return f.filesize
|
||||||
|
}
|
||||||
|
|
||||||
func NewDisk(path string) (DiskFile, error) {
|
func NewDisk(path string) (DiskFile, error) {
|
||||||
info, err := os.Stat(path)
|
info, err := os.Stat(path)
|
||||||
|
|
|
@ -46,8 +46,13 @@ func (t TrashInfo) TrashPath() string { return t.path }
|
||||||
func (t TrashInfo) Path() string { return t.ogpath }
|
func (t TrashInfo) Path() string { return t.ogpath }
|
||||||
func (t TrashInfo) TrashInfo() string { return t.trashinfo }
|
func (t TrashInfo) TrashInfo() string { return t.trashinfo }
|
||||||
func (t TrashInfo) Date() time.Time { return t.trashed }
|
func (t TrashInfo) Date() time.Time { return t.trashed }
|
||||||
func (t TrashInfo) Filesize() int64 { return t.filesize }
|
|
||||||
func (t TrashInfo) IsDir() bool { return t.isdir }
|
func (t TrashInfo) IsDir() bool { return t.isdir }
|
||||||
|
func (t TrashInfo) Filesize() int64 {
|
||||||
|
if t.isdir {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
return t.filesize
|
||||||
|
}
|
||||||
|
|
||||||
func FindTrash(trashdir, ogdir string, f *filter.Filter) (files Files, outerr error) {
|
func FindTrash(trashdir, ogdir string, f *filter.Filter) (files Files, outerr error) {
|
||||||
outerr = filepath.WalkDir(trashdir, func(path string, d fs.DirEntry, err error) error {
|
outerr = filepath.WalkDir(trashdir, func(path string, d fs.DirEntry, err error) error {
|
||||||
|
|
Loading…
Reference in a new issue