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
This commit is contained in:
Martin Grenfell 2009-01-10 21:45:27 +13:00
parent 2038f38026
commit e9f403ac44

View File

@ -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