add oPath#StrForGlob() to return a string that can be used to call globpath with
note: the main motivation behind this is to encapsulate differences in OSs
This commit is contained in:
parent
ec76876a74
commit
da76bafaef
@ -553,7 +553,7 @@ function! s:oTreeDirNode.InitChildren(silent) dict
|
|||||||
|
|
||||||
"get an array of all the files in the nodes dir
|
"get an array of all the files in the nodes dir
|
||||||
let dir = self.path
|
let dir = self.path
|
||||||
let filesStr = globpath(dir.StrForOS(1), '*') . "\n" . globpath(dir.StrForOS(1), '.*')
|
let filesStr = globpath(dir.StrForGlob(), '*') . "\n" . globpath(dir.StrForGlob(), '.*')
|
||||||
let files = split(filesStr, "\n")
|
let files = split(filesStr, "\n")
|
||||||
|
|
||||||
if !a:silent && len(files) > g:NERDTreeNotificationThreshold
|
if !a:silent && len(files) > g:NERDTreeNotificationThreshold
|
||||||
@ -664,7 +664,7 @@ function! s:oTreeDirNode.Refresh() dict
|
|||||||
|
|
||||||
"go thru all the files/dirs under this node
|
"go thru all the files/dirs under this node
|
||||||
let dir = self.path
|
let dir = self.path
|
||||||
let filesStr = globpath(dir.StrForOS(0), '*') . "\n" . globpath(dir.StrForOS(0), '.*')
|
let filesStr = globpath(dir.StrForGlob(), '*') . "\n" . globpath(dir.StrForGlob(), '.*')
|
||||||
let files = split(filesStr, "\n")
|
let files = split(filesStr, "\n")
|
||||||
for i in files
|
for i in files
|
||||||
if i !~ '\.\.$' && i !~ '\.$'
|
if i !~ '\.\.$' && i !~ '\.$'
|
||||||
@ -1210,6 +1210,22 @@ function! s:oPath.StrForEditCmd() dict
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
"FUNCTION: oPath.StrForGlob() {{{3
|
||||||
|
function! s:oPath.StrForGlob() dict
|
||||||
|
let lead = s:os_slash
|
||||||
|
|
||||||
|
"if we are running windows then slap a drive letter on the front
|
||||||
|
if s:running_windows
|
||||||
|
let lead = strpart(getcwd(), 0, 2) . s:os_slash
|
||||||
|
endif
|
||||||
|
|
||||||
|
let toReturn = lead . join(self.pathSegments, s:os_slash)
|
||||||
|
|
||||||
|
if !s:running_windows
|
||||||
|
let toReturn = escape(toReturn, s:escape_chars)
|
||||||
|
endif
|
||||||
|
return toReturn
|
||||||
|
endfunction
|
||||||
"FUNCTION: oPath.StrForOS(esc) {{{3
|
"FUNCTION: oPath.StrForOS(esc) {{{3
|
||||||
"
|
"
|
||||||
"Gets the string path for this path object that is appropriate for the OS.
|
"Gets the string path for this path object that is appropriate for the OS.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user