Thursday, June 20, 2013

Re: Not working wildcards in findfile()

On Thursday, June 20, 2013 6:14:38 AM UTC-5, bv-altensteig wrote:
> I have a question about using wildcards in the path argument to findfile()
>
> function. When running these commands
>
>
>
> mkdir -p "test/dir-1/" && touch "test/dir-1/foo"
>
> mkdir -p "test/dir-2/" && touch "test/dir-2/foo"
>
> mkdir -p "test/dir-3/" && touch "test/dir-3/foo"
>
> vim -u NONE -c "echo string(findfile('foo', 'test/*', -1))|call input('press ENTER to exit')|q"
>
> vim -u NONE -c "echo string(findfile('foo', 'test/dir-*', -1))|call input('press ENTER to exit')|q"
>
>
>
> I would expect vim to output both times the same output of
>
>
>
> ['test/dir-1/foo', 'test/dir-2/foo', 'test/dir-3/foo']
>
>
>
> but the second vim instance only gives
>
>
>
> []
>
>
>
> I don't understand this behavior. What am I doing wrong here?
>

I can't see anything wrong with it, you may have found a bug. I verified the same behavior on Windows gvim 7.3.822.

The same thing happens if you mkdir instead of touch to get subdirectories named "foo", and use finddir() instead of findfile().

Replacing the string(findfile(...)) commands with glob('test/*/foo') and glob('test/dir-*/foo') outputs all three "foo" files as expected, so Vim can expand either wildcard just fine.

--
--
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: