ncdu: fix deleting files

This commit is contained in:
Nick Craig-Wood 2018-11-22 21:41:17 +00:00
parent 84e21ade6b
commit 369a8ee17b
1 changed files with 2 additions and 9 deletions

View File

@ -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
}