nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit e9f403ac44c9fc9efac7c3932569564bde45ed63
parent 2038f38026d35e31615dab20ee7cd7ac8ccc934d
Author: Martin Grenfell <martin_grenfell@msn.com>
Date:   Sat, 10 Jan 2009 21:45:27 +1300

fix a bug where going :NERDTree <relative-path> would fail

Path.New was expecting an absolute path. Now we convert paths to
absolute inside Path.New

Diffstat:
Mplugin/NERD_tree.vim | 23++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -1375,6 +1375,22 @@ endfunction
 "CLASS: Path {{{2
 "============================================================
 let s:Path = {}
+"FUNCTION: Path.AbsolutePathFor(str) {{{3
+function! s:Path.AbsolutePathFor(str)
+    let prependCWD = 0
+    if s:running_windows
+        let prependCWD = a:str !~ '^.:\(\\\|\/\)'
+    else
+        let prependCWD = a:str !~ '^/'
+    endif
+
+    let toReturn = a:str
+    if prependCWD
+        let toReturn = getcwd() . s:os_slash . a:str
+    endif
+
+    return toReturn
+endfunction
 "FUNCTION: Path.bookmarkNames() {{{3
 function! s:Path.bookmarkNames()
     if !exists("self._bookmarkNames")
@@ -1705,13 +1721,11 @@ function! s:Path.equals(path)
 endfunction
 
 "FUNCTION: Path.New() {{{3
-"
 "The Constructor for the Path object
-"Throws NERDTree.Path.InvalidArguments exception.
-function! s:Path.New(fullpath)
+function! s:Path.New(path)
     let newPath = copy(self)
 
-    call newPath.readInfoFromDisk(a:fullpath)
+    call newPath.readInfoFromDisk(s:Path.AbsolutePathFor(a:path))
 
     let newPath.cachedDisplayString = ""
 
@@ -1733,7 +1747,6 @@ function! s:Path.readInfoFromDisk(fullpath)
 
     let self.pathSegments = split(fullpath, '/')
 
-
     let self.isReadOnly = 0
     if isdirectory(a:fullpath)
         let self.isDirectory = 1