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
" FUNCTION: Path._str() {{{1
"
" Gets the string path for this path object that is appropriate for the OS.
" EG, in windows c:\foo\bar
" in *nix /foo/bar
" Return the absolute pathname associated with this Path object. The pathname
" returned is appropriate for the underlying file system.
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()
let lead = self.drive . '\'
let l:leader = self.drive . l:separator
endif
return lead . join(self.pathSegments, s:Path.Slash())
return l:leader . join(self.pathSegments, l:separator)
endfunction
" FUNCTION: Path.strTrunk() {{{1