airblade/vim-rooter

Breaks on recent vim [Windows]

Closed this issue · 4 comments

vim-rooter breaks on latest vim compiled from git.
Other symptoms are that vim seems to hang on startup and takes a really long time - 15-20s before it spits out the error below.

Error detected while processing function <SNR>31_ChangeToRootDirectory[27]..<SNR>31_ChangeDirectory:
line    3:
E344: Can't find directory "\\code\\fruzzy\\rplugin\\python3" in cdpath
E472: Command failed
E344: Can't find directory "\\code\\fruzzy\\rplugin\\python3" in cdpath
Error detected while processing function <SNR>31_ChangeToRootDirectory[27]..<SNR>31_ChangeDirectory:
line    3:
E472: Command failed
Error detected while processing function <SNR>31_ChangeToRootDirectory[27]..<SNR>31_ChangeDirectory:
line    3:
E344: Can't find directory "\\code\\fruzzy\\rplugin\\python3" in cdpath
Error detected while processing function <SNR>31_ChangeToRootDirectory[27]..<SNR>31_ChangeDirectory:
line    3:
E472: Command failed
"_vimrc" [unix] 720L, 21660C
Error detected while processing function <SNR>31_ChangeToRootDirectory[27]..<SNR>31_ChangeDirectory:
line    3:
E344: Can't find directory "\\Users\\raghuramanr\\.vim" in cdpath
Error detected while processing function <SNR>31_ChangeToRootDirectory[27]..<SNR>31_ChangeDirectory:
line    3:
E472: Command failed
session.vim 2.13.1: Opened global 'default' session from ~\.vim\.vimbackups\.sessions\default.vim.

My vim version:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 26 2018 16:00:23)
MS-Windows 64-bit GUI version with OLE support
Included patches: 1-436
Compiled by raghuramanr@ADHARMAN
Huge version with GUI.  Features included (+) or not (-):
+acl               +emacs_tags        +mouseshape        -tag_any_white
+arabic            +eval              +multi_byte        -tcl
+autocmd           +ex_extra          +multi_lang        -termguicolors
+autochdir         +extra_search      -mzscheme          +terminal
+autoservername    +farsi             -netbeans_intg     -tgetent
+balloon_eval      +file_in_path      +num64             -termresponse
-balloon_eval_term +find_in_path      +ole               +textobjects
+browse            +float             +packages          +timers
++builtin_terms    +folding           +path_extra        +title
+byte_offset       -footer            -perl              +toolbar
+channel           +gettext/dyn       +persistent_undo   +user_commands
+cindent           -hangul_input      -postscript        +vartabs
+clientserver      +iconv/dyn         +printer           +vertsplit
+clipboard         +insert_expand     +profile           +virtualedit
+cmdline_compl     +job               -python            +visual
+cmdline_hist      +jumplist          +python3/dyn       +visualextra
+cmdline_info      +keymap            +quickfix          +viminfo
+comments          +lambda            +reltime           +vreplace
+conceal           +langmap           +rightleft         -vtp
+cryptv            +libcall           -ruby              +wildignore
+cscope            +linebreak         +scrollbind        +wildmenu
+cursorbind        +lispindent        +signs             +windows
+cursorshape       +listcmds          +smartindent       +writebackup
+dialog_con_gui    +localmap          +startuptime       -xfontset
+diff              +lua/dyn           +statusline        -xim
+digraphs          +menu              -sun_workshop      -xpm_w32
+directx           +mksession         +syntax            -xterm_save
-dnd               +modify_fname      +tag_binary        
-ebcdic            +mouse             +tag_old_static    
   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$HOME\vimfiles\vimrc"
 3rd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
  2nd user exrc file: "$VIM\_exrc"
  system gvimrc file: "$VIM\gvimrc"
    user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
       defaults file: "$VIMRUNTIME\defaults.vim"
    system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32  -DFEAT_CSCOPE -DFEAT_TERMINAL  -DFEAT_JOB_CHANNEL      -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 /MP -DHAVE_STDINT_H /O2 /GL -DNDEBUG  /Zl /MT -DFEAT_OLE -DFEAT_MBYTE -DFEAT_GUI_W32 -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_LUA -DDYNAMIC_LUA  -DDYNAMIC_LUA_DLL=\"lua51.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python36.dll\" -DFEAT_HUGE /Fd.\ObjGXOUHAMD64/ /Zi
Linking: link  /nologo /subsystem:windows /opt:ref /LTCG:STATUS /HIGHENTROPYVA:NO oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib netapi32.lib uuid.lib /machine:AMD64 gdi32.lib version.lib   winspool.lib comctl32.lib advapi32.lib shell32.lib netapi32.lib  /machine:AMD64  libcmt.lib oleaut32.lib user32.lib  /nodefaultlib:lua51.lib    /nodefaultlib:python36.lib    WSock32.lib  /PDB:gvim.pdb -debug

Do you still get this error with the previous commit (7241d8f)?

How about if you temporarily move your session file (~\.vim\.vimbackups\.sessions\default.vim) away?

With previous commit 7241d8f, no errors.

OK, so it's an escaping problem. I don't know how to escape filenames on Windows for findfile() and finddir() (see my comment on #80). Do you?

Usually just enclosing stuff in double quotes works on windows. Dunno about vimscript

This is hacky :)

  let escCh = ' ,'
  if has("unix")
    let escCh .= '\'
  endif
  let fd_dir_escaped = escape(fd_dir, escCh)