Refactor the "Path._str()" method

This method was using hardcoded values rather than provided
abstractions to do its work. These improvements were necessary.
This commit is contained in:
Jason Franklin 2017-08-11 09:43:57 -04:00
parent 19b8dd7b60
commit 7a2fc6b6b9

View File

@ -762,19 +762,17 @@ function! s:Path._strForGlob()
endfunction endfunction
" FUNCTION: Path._str() {{{1 " FUNCTION: Path._str() {{{1
" " Return the absolute pathname associated with this Path object. The pathname
" Gets the string path for this path object that is appropriate for the OS. " returned is appropriate for the underlying file system.
" EG, in windows c:\foo\bar
" in *nix /foo/bar
function! s:Path._str() function! s:Path._str()
let lead = s:Path.Slash() let l:separator = s:Path.Slash()
let l:leader = l:separator
"if we are running windows then slap a drive letter on the front
if nerdtree#runningWindows() if nerdtree#runningWindows()
let lead = self.drive . '\' let l:leader = self.drive . l:separator
endif endif
return lead . join(self.pathSegments, s:Path.Slash()) return l:leader . join(self.pathSegments, l:separator)
endfunction endfunction
" FUNCTION: Path.strTrunk() {{{1 " FUNCTION: Path.strTrunk() {{{1