fixed root path error for windows (#935)

* fixed root path error for windows

* simplify condition check
This commit is contained in:
zcodes 2019-02-01 20:50:55 +08:00 committed by Phil Runninger
parent 72c3656799
commit 8cc154d4b0

View File

@ -15,7 +15,7 @@ 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
@ -23,7 +23,13 @@ function! s:Path.AbsolutePathFor(pathStr)
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