Filename case sensitiveness in JARs...

Is it possible to disable the filename case sensitiveness of the JAR’s file system (accessed via getClassLoader().getResourceAsStream(file_url) ) temporary ?

Actually I like this filename case sensitiveness and usually it’s no problem when you create your resource files.
However, say, some other person(s) alters your resources in a networked directory and this happens frquently…

Is there a magic switch somewhere :wink: or do I have to add some GAWK lines to my JAR packing procedure?

I tend to feel that the better solution is to take a crowbar to whomever keeps messing with the filename case. Otherwise you’re going to have horrible problems the moment you do want to distinguish based on case…

URLs are case sensitive. Coding around such a fundamental reality will probably be damaging in the long run.

Thanks for the answer.
I see. So I’ll have to transform somehow the filenames inside the 3d model files to stay together with what is stored in the directories…

Yep. Java resource names are case sensative.

You COULD write a custom classloader that redefined “findResource” to match case insensitive.

That woudl be pretty evil though…

[quote]Yep. Java resource names are case sensative.
[/quote]
Actually I like this feature. Remembers me to Unix. Probably with MacOS-X file names are case sensitive, too? (It’s based on Unix, after all.) So just the Windoze users have this case sensitive problem when moving resource files to JARs, because those artists with Windoze systems never care about the file name cases when they do their models/scenes.

[quote]You COULD write a custom classloader that redefined “findResource” to match case insensitive.

That woudl be pretty evil though…
[/quote]
Yes.
Well, I’m going to add some AWK lines to my JAR packing script and also add some Regexps to the Java 3d model loader.

Btw. Those at SUN who decided to include Regexps with Java are my “local hero” (nice movie btw). Regexps are so cool.

No, lots of linux users who access foreign filing systems too - either network shares or FAT etc (NB it’s not just windows that uses FAT…). There are bugs in the linux kernel/filesystems which mean it artificially alters case on lots of filesystems; main example is all-uppercase filename ALWAYS get transformed to all lowercase. There is AFAIAA currently NO way around this (have to ask java developers to change their class names if they have any all upper case, or else copy everything to a different filesystem; however, IIRC when you copy it back, the stupid linux FS subsystem does the translate again!).

IIRC this is not completely true? (but its been a while since I was reading the appropriate RFC’s etc…).

Some sections of a URL are case-insensitive. E.g. the DNS system is case-insensitive, and IIRC web-server developers are requested to make their filenames case-insensitive BUT “case preserving” - e.g. so that URL queries that contain data e.g. from a form are not transformed?

Ditto IIRC the protocol field in a URL/URI?

I remember a time when many webservers were case sensitive, but that has definitely changed - but this could easily just be for convenience so I really don’t know.

P.S. Case sensitivity is, in general, a bad idea in user interfaces. OTOH it is just as powerfully a very very good idea in non-user stuff, like code; not because it makes it easier to write code, but because it’s easier to transfer around data, where different case has a lot more meaning, and case-sensitive systems can safely be used as a vector for such data (e.g. linux cannot [always], as described above, and this is a pain and a problem). IMHO, URL’s are aimed more at users and so ought to be case insensitive; ditto filenames. I use both sensitive and insensitive FS’s so much I automatically know which is which without thinking about it, but IME it has often been the cause of many problems and bugs in multi-person teams…

[quote]IIRC this is not completely true? (but its been a while since I was reading the appropriate RFC’s etc…).
[/quote]
Yeah, not completely true, but near enough! ;D

I believe for all/most Internet-relevant URLs the protocol is case-insensitive, username/password is left to the implementation (usually case-sensitive), the server name is case-insensitive, and the path is all case-sensitive. But unless you’re writing something to interpret and act on URLs, nothing can go wrong if you treat the whole thing as case-sensitive.