Closed timotheecour closed 6 years ago
Have you tested? Because this is where I started but this only works for matching a single path to a single pattern (ie using matches
). It doesn't work in the walker, and it doesn't handle non-magic matches. The latter is why the makeCaseInsensitive
proc exists in #19.
That proc takes a pattern like src/glob.nim
and (on case sensitive systems where it's necessary) changes each character into a character class containing its lower and upper case forms (allowing it to match either in that position). That pattern ends up becoming [sS][rR][cC]/[gG][lL][oO][bB].[nN][iI][mM]
. Now we can pass that to Nim's walkPattern
iterator to find all the items that match.
So while in master
we just check if the file exists - that doesn't work on case sensitive systems if you want a case insensitive match. We need to do the above to find all the possible matches. That make sense?
you may be right, will close for now
tried on OSX (which is case insensitive), and passing a pattern with wrong case; it seems to work; am I missing something ?
WIP fix for https://github.com/citycide/glob/issues/12 , but a full PR would need to forward
caseSensitive
optional argument from top-level API, but something like that seems much simpler than https://github.com/citycide/glob/commit/7115d8d39d420beaf4bf4c3f167105183576c305feel free to close this and incorporate that into your other PR