correct message for folders that lf has no permission for (#203)
This commit is contained in:
parent
cb36e87b80
commit
27861f06e2
2
nav.go
2
nav.go
@ -82,6 +82,7 @@ type dir struct {
|
|||||||
files []*file // displayed files in directory including or excluding hidden ones
|
files []*file // displayed files in directory including or excluding hidden ones
|
||||||
allFiles []*file // all files in directory including hidden ones (same array as files)
|
allFiles []*file // all files in directory including hidden ones (same array as files)
|
||||||
sortType sortType // sort method and options from last sort
|
sortType sortType // sort method and options from last sort
|
||||||
|
noPerm bool // whether lf has no permission to open the directory
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDir(path string) *dir {
|
func newDir(path string) *dir {
|
||||||
@ -97,6 +98,7 @@ func newDir(path string) *dir {
|
|||||||
path: path,
|
path: path,
|
||||||
files: files,
|
files: files,
|
||||||
allFiles: files,
|
allFiles: files,
|
||||||
|
noPerm: os.IsPermission(err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
ui.go
5
ui.go
@ -251,6 +251,11 @@ func (win *win) printDir(dir *dir, selections map[string]int, saves map[string]b
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if dir.noPerm {
|
||||||
|
win.print(2, 0, termbox.AttrReverse, termbox.ColorDefault, "permission denied")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if len(dir.files) == 0 {
|
if len(dir.files) == 0 {
|
||||||
win.print(2, 0, termbox.AttrReverse, termbox.ColorDefault, "empty")
|
win.print(2, 0, termbox.AttrReverse, termbox.ColorDefault, "empty")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user