From 369a8ee17b80816734ec8c18825fb53d49cfb29c Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 22 Nov 2018 21:41:17 +0000 Subject: [PATCH] ncdu: fix deleting files --- cmd/ncdu/ncdu.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/cmd/ncdu/ncdu.go b/cmd/ncdu/ncdu.go index 90d37d3be..343647e41 100644 --- a/cmd/ncdu/ncdu.go +++ b/cmd/ncdu/ncdu.go @@ -424,20 +424,13 @@ func (u *UI) removeEntry(pos int) { func (u *UI) delete() { dirPos := u.sortPerm[u.dirPosMap[u.path].entry] entry := u.entries[dirPos] - - file := false - d, _ := u.d.GetDir(dirPos) - if d == nil { - file = true - } - u.boxMenu = []string{"cancel", "confirm"} - if file { + if obj, isFile := entry.(fs.Object); isFile { u.boxMenuHandler = func(f fs.Fs, p string, o int) (string, error) { if o != 1 { return "Aborted!", nil } - err := f.Rmdir(entry.String()) + err := operations.DeleteFile(obj) if err != nil { return "", err }