haltcase / glob

Pure Nim library for matching file paths against Unix style glob patterns.
https://glob.bolingen.me
MIT License
61 stars 5 forks source link

[macOS] casing of returned paths doesn't match filesystem #32

Closed timotheecour closed 6 years ago

timotheecour commented 6 years ago

/cc @citycide

nimble test

[Suite] pattern walking / listing
  [OK] basic
  [OK] leading magic
  [OK] `Directories` includes matching directories in the results
    /Users/timothee/git_clone/temp/glob/tests.nim(380, 21): Check failed: seqsEqual(toSeq(walkGlob("TEMP/**", options = o)), @[p"temp/deep/dir/file.nim",
    p"temp/not_as/deep.jpg", p"temp/not_as/deep.nim", p"temp/shallow.nim"])
  [FAILED] `IgnoreCase` enables case insensitive matching

I'm on OSX. this is on a fresh clone

haltcase commented 6 years ago

The results are actually correct, it's just a casing difference between expected & actual.

We're expecting:

temp/deep/dir/file.nim
temp/not_as/deep.jpg
temp/not_as/deep.nim
temp/shallow.nim

But on macOS we receive:

TEMP/deep/dir/file.nim
TEMP/not_as/deep.jpg
TEMP/not_as/deep.nim
TEMP/shallow.nim

I'm not entirely sure yet why this is different on macOS than it is on Windows which is also case insensitive.


edit: traced it to this spot, which evidently isn't enough on macOS systems so if we want to match filesystem casing (and I'd like to) we'll need to find another way.

https://github.com/citycide/glob/blob/17675cc427efdc3e34855bffacbfc92817e6a0a7/src/glob.nim#L309-L312

edit 2: expandFilename would probably do it