From 2e82cd23887a665e146647b2791fb899f5c03571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Tue, 18 Jun 2024 17:01:38 -0700 Subject: [PATCH] trash files instead of containing dir oops --- internal/files/files.go | 1 + main.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/files/files.go b/internal/files/files.go index be3d180..b0a479f 100644 --- a/internal/files/files.go +++ b/internal/files/files.go @@ -26,6 +26,7 @@ type Files []File func (f File) Name() string { return f.name } 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) Filesize() int64 { return f.filesize } diff --git a/main.go b/main.go index 78e90cd..d336a18 100644 --- a/main.go +++ b/main.go @@ -90,8 +90,8 @@ var ( if confirm(fmt.Sprintf("trash these %d files?", len(fls))) { tfs := make([]string, 0, len(fls)) for _, file := range fls { - log.Debugf("gonna trash %s", file.Path()) - tfs = append(tfs, file.Path()) + log.Debugf("gonna trash %s", file.Filename()) + tfs = append(tfs, file.Filename()) } trashed, err := trash.TrashFiles(trashDir, tfs...)