nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit da76bafaefc71799eb5516d1914fbb6887a37e42
parent ec76876a74ed5e1b5efe03a932d7d9a076c20294
Author: Martin Grenfell <martin_grenfell@msn.com>
Date:   Sun,  4 May 2008 21:33:52 +1200

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

Diffstat:
Mplugin/NERD_tree.vim | 20++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -553,7 +553,7 @@ function! s:oTreeDirNode.InitChildren(silent) dict
 
     "get an array of all the files in the nodes dir 
     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")
 
     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 
     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")
     for i in files
         if i !~ '\.\.$' && i !~ '\.$'
@@ -1210,6 +1210,22 @@ function! s:oPath.StrForEditCmd() dict
     endif
 
 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 
 "
 "Gets the string path for this path object that is appropriate for the OS.