Merge pull request #110 from cperl82/fixes

Symlinks Not Showing as Symlinks
This commit is contained in:
Martin Grenfell 2012-01-11 12:19:41 -08:00
commit eced5f98a0

View File

@ -2543,6 +2543,16 @@ function! s:Path.Slash()
return s:running_windows ? '\' : '/'
endfunction
"FUNCTION: Path.Resolve() {{{3
"Invoke the vim resolve() function and return the result
"This is necessary because in some versions of vim resolve() removes trailing
"slashes while in other versions it doesn't. This always removes the trailing
"slash
function! s:Path.Resolve(path)
let tmp = resolve(a:path)
return tmp =~# '/$' ? substitute(tmp, '/$', '', '') : tmp
endfunction
"FUNCTION: Path.readInfoFromDisk(fullpath) {{{3
"
"
@ -2577,12 +2587,12 @@ function! s:Path.readInfoFromDisk(fullpath)
let lastPathComponent = self.getLastPathComponent(0)
"get the path to the new node with the parent dir fully resolved
let hardPath = resolve(self.strTrunk()) . lastPathComponent
let hardPath = s:Path.Resolve(self.strTrunk()) . '/' . lastPathComponent
"if the last part of the path is a symlink then flag it as such
let self.isSymLink = (resolve(hardPath) != hardPath)
let self.isSymLink = (s:Path.Resolve(hardPath) != hardPath)
if self.isSymLink
let self.symLinkDest = resolve(fullpath)
let self.symLinkDest = s:Path.Resolve(fullpath)
"if the link is a dir then slap a / on the end of its dest
if isdirectory(self.symLinkDest)
@ -2755,13 +2765,9 @@ function! s:Path._str()
endfunction
"FUNCTION: Path.strTrunk() {{{3
"Gets the path without the last segment on the end, always with an endslash
"Gets the path without the last segment on the end.
function! s:Path.strTrunk()
let toReturn = self.drive . '/' . join(self.pathSegments[0:-2], '/')
if toReturn !~# '\/$'
let toReturn .= '/'
endif
return toReturn
return self.drive . '/' . join(self.pathSegments[0:-2], '/')
endfunction
" FUNCTION: Path.tabnr() {{{3
@ -2996,7 +3002,7 @@ function! s:initNerdTree(name)
if dir =~# '^\.'
let dir = getcwd() . s:Path.Slash() . dir
endif
let dir = resolve(dir)
let dir = s:Path.Resolve(dir)
try
let path = s:Path.New(dir)