@@ -42,21 +42,21 @@ function! s:parent_dir(dir) abort
4242endfunction
4343
4444if v: version > 703
45- function ! s: globlist (pat) abort
46- return glob ( a: pat , ! s: suf (), 1 )
45+ function ! s: globlist (dir_esc, pat) abort
46+ return globpath ( a: dir_esc , a: pat , ! s: suf (), 1 )
4747endfunction
4848else " Vim 7.3 glob() cannot handle filenames containing newlines.
49- function ! s: globlist (pat) abort
50- return split (glob ( a: pat , ! s: suf ()), " \n " )
49+ function ! s: globlist (dir_esc, pat) abort
50+ return split (globpath ( a: dir_esc , a: pat , ! s: suf ()), " \n " )
5151endfunction
5252endif
5353
5454function ! s: list_dir (dir ) abort
55- " Escape for glob ().
56- let dir_esc = escape (substitute ( a: dir ,' \[ ' , ' [[] ' , ' g ' ), ' {} ' )
57- let paths = s: globlist (dir_esc. ' *' )
55+ " Escape comma for globpath ().
56+ let dir_esc = escape (a: dir , ' , ' )
57+ let paths = s: globlist (dir_esc, ' *' )
5858 " Append dot-prefixed files. glob() cannot do both in 1 pass.
59- let paths = paths + s: globlist (dir_esc. ' .[^.]*' )
59+ let paths = paths + s: globlist (dir_esc, ' .[^.]*' )
6060
6161 if get (g: , ' dirvish_relative_paths' , 0 )
6262 \ && a: dir != s: parent_dir (getcwd ()) " avoid blank CWD
0 commit comments