trash files instead of containing dir

oops
This commit is contained in:
Lilian Jónsdóttir 2024-06-18 17:01:38 -07:00
parent 3e3b97b2c1
commit 2e82cd2388
2 changed files with 3 additions and 2 deletions

View file

@ -26,6 +26,7 @@ type Files []File
func (f File) Name() string { return f.name } func (f File) Name() string { return f.name }
func (f File) Path() string { return f.path } func (f File) Path() string { return f.path }
func (f File) Filename() string { return filepath.Join(f.path, f.name) }
func (f File) Modified() time.Time { return f.modified } func (f File) Modified() time.Time { return f.modified }
func (f File) Filesize() int64 { return f.filesize } func (f File) Filesize() int64 { return f.filesize }

View file

@ -90,8 +90,8 @@ var (
if confirm(fmt.Sprintf("trash these %d files?", len(fls))) { if confirm(fmt.Sprintf("trash these %d files?", len(fls))) {
tfs := make([]string, 0, len(fls)) tfs := make([]string, 0, len(fls))
for _, file := range fls { for _, file := range fls {
log.Debugf("gonna trash %s", file.Path()) log.Debugf("gonna trash %s", file.Filename())
tfs = append(tfs, file.Path()) tfs = append(tfs, file.Filename())
} }
trashed, err := trash.TrashFiles(trashDir, tfs...) trashed, err := trash.TrashFiles(trashDir, tfs...)