nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 8cc154d4b0cf28f73815050b9782e6ac5a4d733d
parent 72c3656799289d4635520c28e17f737066ce19d6
Author: zcodes <zcodes@users.noreply.github.com>
Date:   Fri,  1 Feb 2019 20:50:55 +0800

fixed root path error for windows (#935)

* fixed root path error for windows

* simplify condition check

Diffstat:
Mlib/nerdtree/path.vim | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/nerdtree/path.vim b/lib/nerdtree/path.vim
@@ -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