arnetheduck / nph

An opinionated code formatter for Nim
Other
77 stars 12 forks source link

Does not compile on windows. #4

Closed treeform closed 6 months ago

treeform commented 6 months ago

C:\p\nph\src\phmsgs.nim(111, 15) Error: expression 'canonicalCase(string(canon))' is of type 'string' and has to be used (or discarded)

I think this code is invalid when FileSystemCaseSensitive is false like on windows:

proc canonicalCase(path: var string) {.inline.} =
  ## the idea is to only use this for checking whether a path is already in
  ## the table but otherwise keep the original case
  when FileSystemCaseSensitive:
    discard
  else:
    toLowerAscii(path)
treeform commented 6 months ago

work around

    path = toLowerAscii(path)

in the last branch

arnetheduck commented 6 months ago

5