On Sun, Feb 8, 2009 at 6:28 PM, Tony Mechelynck wrote:
>
> On 08/02/09 23:18, John Beckett wrote:
>> Dewr wrote:
>>> can you check if there is a file by path and name?
>>
>> Example:
>>   :echo filereadable($MYVIMRC)
>
> Of course, if the file exists but you don't have read permission on it,
> filereadable() will return FALSE, and yet in that case you will usually
> not be able to overwrite it.
>
> The same family of functions also includes
>        executable()
>        filewritable()
>        isdirectory()
>
> In addition, findfile() and finddir() can search the directory hierarchy
> both up and down, and they will return the empty string if nothing is found.

And let's not forget good old glob().  glob('/path/to/Makefile')
returns either '' or '/path/to/Makefile', so as long as you know the
file to be found doesn't have any glob characters in the name, it's an
option.

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to