CC: Tweaked

CC: Tweaked

42M Downloads

Allow `fs.find` to be case insensitive

Jummit opened this issue ยท 4 comments

commented

fs.find is a very powerful function, but it lacks a case-insesitive option for it to be usable imo. A simple caseSensitive parameter would suffice.

e.g.

find(path, caseSensitive)
commented

As a Linux user, case-sensitivity by default is really nice*. I support adding this option even if it doesn't do anything on some platforms. And the StackOverflow post @sir-maniac linked seems to provide a method for providing case-sensitivity on Windows and Linux (and, let's face it, Mac users probably make up a minority of CC users.** Also, iirc macOS's case-insensitive filesystems can still be partially case-sensitive, since Bash still acts like things are case-sensitive even on a case-insensitive filesystem).

*At least, I'm used to it.
** Then again, there may well be Linux users of CC than Mac users.

commented

IMHO it would be useful to default to case-insensitivity so a person can write scripts on Windows(or Mac), share them with people(who often will use them on servers, which are likely Linux), and the scripts will "just work."

@Ocawesome101, I personally like case-sensitivity too. But many novice programmers will likely not be thinking of case when they are accessing their own files on Windows(or Mac), which will silently break after it is shared. With potentially non-obvious error messages(could be wrong about that).

Of course, enforcing case-sensitivity across platforms would also fix this, but this might break legacy scripts.

commented

CC is pretty much designed not to give access to the real world(with a few exceptions).

Maybe the filesystem should be case-insensitive on all platforms, which wouldn't be too hard to detect and mitigate.

commented

I think this is going to depend on whether or not your underlying filesystem is case-sensitive. NTFS has case-sensitivity, but it's hidden while running under Windows. HFS+ on macOS is also case-insensitive by default. Linux is the only OS (where Minecraft runs) where case-sensitivity is the default. So for operating systems/filesystems with case sensitivity disabled, adding a caseSensitive option isn't going to be useful.