apainintheneck / globlin

File globbing for Gleam
https://hexdocs.pm/globlin
MIT License
6 stars 0 forks source link

Add support for Windows file paths #9

Open apainintheneck opened 2 months ago

apainintheneck commented 2 months ago

Currently only Unix file paths are supported and it'd be nice to be able to match against everything.

apainintheneck commented 2 months ago

It seems like what Python does in fnmatch is to normalize paths by downcasing them and substituting "\" for "/". The substitution would be simple enough to add here though I do wonder if downcasing is really necessary at all here since there is already a flag for case insensitive matching.

apainintheneck commented 2 months ago

The weird thing is that it only seems to normalize windows paths when run on windows.

apainintheneck commented 2 months ago

Ah, I see now that the main difference is that on Windows the backslash is a path separator component while on Unix systems it's just treated as a normal character (at least that goes for macOS). I'm not sure if this should be the responsibility of this library if there isn't a generic solution here.