Skip to content

Commit b660af1

Browse files
committed
feat: show error if directory is not readable
1 parent 0966b86 commit b660af1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

autoload/dirvish.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,12 @@ func! s:buf_render(dir, lastpath) abort
414414
endif
415415
" Place cursor on the tail (last path segment).
416416
call search('\'.s:sep.'\zs[^\'.s:sep.']\+\'.s:sep.'\?$', 'c', line('.'))
417+
418+
" TRICK: From :help getfperm(): "If the directory cannot be read, empty string is returned."
419+
" This misses the "--x" case (no "r" access), but it's the best we have.
420+
if empty(getline(1)) && '' ==# getfperm(a:dir . '/.')
421+
call s:msg_error(printf('cannot list directory (permissions: %s): %s', getfperm(a:dir), a:dir))
422+
endif
417423
endf
418424

419425
func! s:apply_icons() abort

0 commit comments

Comments
 (0)