Saturday, April 29, 2023

Re: surprising glob() result on Windows

On 04/29/2023 9:26 AM, Bram Moolenaar wrote:
>
>> Briefly, I have a case where glob("*.ext") returns more files than I
>> expect.
>>
>> To give an example, in a directory of your choice create two files named
>> "test.any" and "zest.anyother". The important detail is that the second
>> filename's extension be prefixed by the first filename's extension.
>>
>> Then launch Vim in that directory and run the command
>> :echo glob("*.any")
>> Both files are returned, not just "test.any".
>>
>> I see this on Windows running vim 9.0.1240 with normal features built
>> with Visual C. On the other hand, Vim on my linux box returns only
>> "test.any", as I would expect, so I don't think this a feature. :)
>>
>> Any comments?
>
> What file system is being used?

Windows 10 with NTFS.

Some older filesystems use a trick to
> make long file names possible. The file then appears twice in the
> directory, once with the short name and once with the long name. Vim
> may find a match with the short name, includes it in the list of
> matches and then expands it to the long name.
> See https://en.wikipedia.org/wiki/Long_filename
>


--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/u2j8je%2419c%241%40ciao.gmane.io.

No comments: