Skip to content

Commit

Permalink
fixed root path error for windows (#935)
Browse files Browse the repository at this point in the history
* fixed root path error for windows

* simplify condition check
  • Loading branch information
zcodes authored and PhilRunninger committed Feb 1, 2019
1 parent 72c3656 commit 8cc154d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/nerdtree/path.vim
Expand Up @@ -15,15 +15,21 @@ function! s:Path.AbsolutePathFor(pathStr)
let l:prependWorkingDir = 0

if nerdtree#runningWindows()
let l:prependWorkingDir = a:pathStr !~# '^.:\(\\\|\/\)' && a:pathStr !~# '^\(\\\\\|\/\/\)'
let l:prependWorkingDir = a:pathStr !~# '^.:\(\\\|\/\)\?' && a:pathStr !~# '^\(\\\\\|\/\/\)'
else
let l:prependWorkingDir = a:pathStr !~# '^/'
endif

let l:result = a:pathStr

if l:prependWorkingDir
let l:result = getcwd() . s:Path.Slash() . a:pathStr
let l:result = getcwd()

if l:result[-1:] == s:Path.Slash()
let l:result = l:result . a:pathStr
else
let l:result = l:result . s:Path.Slash() . a:pathStr
endif
endif

return l:result
Expand Down

0 comments on commit 8cc154d

Please sign in to comment.