mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 19:33:50 -05:00
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:
@@ -1375,6 +1375,22 @@ endfunction
|
|||||||
"CLASS: Path {{{2
|
"CLASS: Path {{{2
|
||||||
"============================================================
|
"============================================================
|
||||||
let s:Path = {}
|
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: Path.bookmarkNames() {{{3
|
||||||
function! s:Path.bookmarkNames()
|
function! s:Path.bookmarkNames()
|
||||||
if !exists("self._bookmarkNames")
|
if !exists("self._bookmarkNames")
|
||||||
@@ -1705,13 +1721,11 @@ function! s:Path.equals(path)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: Path.New() {{{3
|
"FUNCTION: Path.New() {{{3
|
||||||
"
|
|
||||||
"The Constructor for the Path object
|
"The Constructor for the Path object
|
||||||
"Throws NERDTree.Path.InvalidArguments exception.
|
function! s:Path.New(path)
|
||||||
function! s:Path.New(fullpath)
|
|
||||||
let newPath = copy(self)
|
let newPath = copy(self)
|
||||||
|
|
||||||
call newPath.readInfoFromDisk(a:fullpath)
|
call newPath.readInfoFromDisk(s:Path.AbsolutePathFor(a:path))
|
||||||
|
|
||||||
let newPath.cachedDisplayString = ""
|
let newPath.cachedDisplayString = ""
|
||||||
|
|
||||||
@@ -1733,7 +1747,6 @@ function! s:Path.readInfoFromDisk(fullpath)
|
|||||||
|
|
||||||
let self.pathSegments = split(fullpath, '/')
|
let self.pathSegments = split(fullpath, '/')
|
||||||
|
|
||||||
|
|
||||||
let self.isReadOnly = 0
|
let self.isReadOnly = 0
|
||||||
if isdirectory(a:fullpath)
|
if isdirectory(a:fullpath)
|
||||||
let self.isDirectory = 1
|
let self.isDirectory = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user