I am writing a linting tool; one of the rules enforces that all linked files have lowercase filenames on disk, ie:
-
some/asset.png
== OK -
another/asset.PNG
== Fail
I was hoping to validate this rule with the following code:
f, err := os.Stat("another/asset.png")
actualName := f.Name()
However the retun value of f.Name()
always reflects the value passed to os.Stat()
, eg: passing os.Stat("foo.BAR")
will yield foo.BAR
even if the file is named foo.BaR
on disk.
Am I just approaching this problem wrong? Is there another way to get the actual, case-sensitive filename on disk for a given filepath?
Thanks.