We could use a hasExt function in std.path

2011-04-01 Thread Andrej Mitrovic
At least on Windows, as far as I know, the casing of a file extension doesn't come into play. But when comparing extensions, you have to be careful to lowercase the result of `getExt()`, for example: foreach (string name; dirEntries(curdir, SpanMode.shallow)) { if (name.isFile name.getExt

Re: We could use a hasExt function in std.path

2011-04-01 Thread Andrej Mitrovic
On 4/1/11, Andrej Mitrovic n...@none.none wrote: I often have to search for files that have a certain extension. Having to expand the code to the following becomes ugly real fast: foreach (string name; dirEntries(curdir, SpanMode.shallow)) { if (name.isFile name.hasExt.tolower == ini ||

Re: We could use a hasExt function in std.path

2011-04-01 Thread spir
On 04/01/2011 11:03 PM, Andrej Mitrovic wrote: At least on Windows, as far as I know, the casing of a file extension doesn't come into play. But when comparing extensions, you have to be careful to lowercase the result of `getExt()`, for example: foreach (string name; dirEntries(curdir,

Re: We could use a hasExt function in std.path

2011-04-01 Thread Andrej Mitrovic
Match a single extension or any number of extensions. I've said range, but I didn't mean a custom type. Just that it works with either 1 value or an array of values.