Fixed resolve() double endslash defect

This commit is contained in:
Dave Aitken 2011-07-07 02:51:13 -07:00
parent 0b0c76626b
commit bc745b6e99

View File

@ -2297,7 +2297,7 @@ function! s:Path.readInfoFromDisk(fullpath)
let lastPathComponent = self.getLastPathComponent(0) let lastPathComponent = self.getLastPathComponent(0)
"get the path to the new node with the parent dir fully resolved "get the path to the new node with the parent dir fully resolved
let hardPath = resolve(self.strTrunk()) . '/' . lastPathComponent let hardPath = resolve(self.strTrunk()) . lastPathComponent
"if the last part of the path is a symlink then flag it as such "if the last part of the path is a symlink then flag it as such
let self.isSymLink = (resolve(hardPath) != hardPath) let self.isSymLink = (resolve(hardPath) != hardPath)
@ -2472,9 +2472,13 @@ function! s:Path._str()
endfunction endfunction
"FUNCTION: Path.strTrunk() {{{3 "FUNCTION: Path.strTrunk() {{{3
"Gets the path without the last segment on the end. "Gets the path without the last segment on the end, always with an endslash
function! s:Path.strTrunk() function! s:Path.strTrunk()
return self.drive . '/' . join(self.pathSegments[0:-2], '/') let toReturn = self.drive . '/' . join(self.pathSegments[0:-2], '/')
if toReturn !~# '\/$'
let toReturn .= '/'
endif
return toReturn
endfunction endfunction
"FUNCTION: Path.WinToUnixPath(pathstr){{{3 "FUNCTION: Path.WinToUnixPath(pathstr){{{3