Monday, March 18, 2013

redir and glob

I want to create a list of files that my project is using. This list will be stored in a file and subsequently will be used by cscope.

Here is what I have so far:

function! BuildFileList()
s:dir_list = ['dir1', 'dir2', 'dir3']
s:output_file = 'cscope.files'
redir! > s:output_file
for dir in s:dir_list
glob(dir.'*.[ch]')
endfor
redir END
endfunction

silent call BuildFileList

I'm getting the following errors when I execute this function:
E190: Cannot open "s:output_file" for writing
E486: Pattern not found: dir."*.[ch]"

Obviously there is something wrong with the way I use redir and glob, but I can't get my finger on it. Does anybody know what am I doing wrong?

Any help is really appreciated.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: