I was under the impression that Windows was the only case insensitive file system. That is not the case. In RubyGems, there are places in both code and tests where this needs to be accounted for.
Although none come to mind, the same may exist here. I haven't seen anything defining it's state. If I'm not mistaken, could something like the following be added, maybe as an additional CONFIG key or constant somewhere?
note that Ruby has a significant perf impact on case-insensitive filesystem already. In order to support this feature, Ruby would have to check filesystem capabilities on the fly and on every single FS operation that matters. For that reason I don't care much about fixing it.
unlike ruby, shell's glob finds a file, but it doesn't return a real filename as a result.
ls /mnt/c/aaa.txt
=> /mnt/c/aaa.txt (wrong)
ls /mnt/c/aAa.txt
=> /mnt/c/aAa.txt
https://ruby-doc.org/core-2.5.0/Dir.html
Note that the pattern is not a regexp, it's closer to a shell glob. See File.fnmatch for the meaning of the flags parameter. Case sensitivity depends on your system (File::FNM_CASEFOLD is ignored), as does the order in which the results are returned.
Now, I'm pretty much only windows, but previously the network I used had Windows, MacOS/OSX, and a few of *nix NAS devices. I vaguely recall some casing issues. Unfortunately, I can't test anything like that now.
Maybe the questions are:
Should Ruby attempt to account for case insensitive file systems? The main issue I've come across is in comparisons using ENV variables that contain paths.
You can't compare path names just by case-insensitiveness, on Windows.
Consider short file names.
You can compare them by File.identical? instead, or should use File.expand_path before comparison at least.
You can't compare path names just by case-insensitiveness, on Windows.
Consider short file names.
You can compare them by File.identical? instead, or should use File.expand_path before comparison at least.
Thank you for the mention of File.indentical?, as I have never noticed that method. Using File.exist? does correctly identify Windows as being case sensitive, but will give a false positive if, for instance, one has folders /Ruby and /ruby on a case sensitive file system. Unlikely, but possible...
I'm not sure about the effect of short file names. If test is a string, and File.exist? test is true, then the following should work?