LDraw.org Discussion Forums
Lower-casing the library - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: General (https://forums.ldraw.org/forum-12.html)
+--- Forum: Official File Specifications/Standards (https://forums.ldraw.org/forum-32.html)
+--- Thread: Lower-casing the library (/thread-17235.html)

Pages: 1 2


Re: Lower-casing the library - Sylvain Sauvage - 2015-09-18

Roland Melkert Wrote:As you know LDraw references are case insensitive
De facto, yes.
De jure, as I was saying in what Philo quoted, since the 8.3 MSDOS restrictions were dropped, it’s not written anywhere.


Re: Lower-casing the library - Sylvain Sauvage - 2015-09-18

Orion Pobursky Wrote:It's trivial to program for case insensitivity

Of the programs I have access to the code:

LPub:
Reads “as-is.”
When adding paths, it thinks all directories names of LDraw are lowercase.
Sum-up: trivially fails (as a lot of .dat don’t refer to others in all-lowercase).

LDView:
Tries all-lower, then all-upper, then as-is, then fails.
The filenames include the paths. So if the files are somewhere like ~/Documents/LDraw/…, only the as-is versions could be found. A lot of LDraw official parts wouldn’t because of the internal mess of the library.
Sum-up: trivially fails.

LeoCAD:
Reads the parts.lst or all the .dat, stores the model-names in all-upper.
It’s okay because, even if it thinks that all directories and files’ names of LDraw are lowercase (which is only false for LDConfig.ldr), it doesn’t touch the library’s path.
Sum-up: works (except for LDConfig.ldr, for now).

For the other main programs I know of (MLCAD, LDCAD, etc.), either they are Windows only, and the question doesn’t arise (ditto in Wine), or closed-source, and I won’t know.

Orion Pobursky Wrote:and decent programs account for this.

So, either it’s not so trivial or LDView, LPub and LeoCAD are not decent programs.
I’m sure their developers would be happy to know that.

Orion Pobursky Wrote:The official library standard implies it for filenames so maybe we should revise the file spec to require it as well.

Yes, it’s trivial to write a specification that says which filenames are case sensitive and which aren’t and eases the programmers’ job of finding those files.

Orion Pobursky Wrote:Also, I might point out that LeoCAD is not an LDraw compatible program but merely has the ability to import LDraw files.

As another answer says, that is not true anymore since several versions (even the output format has changed from ad-hoc-binary to LDR-with-comments).

But the fact that the problem was raised on the LeoCAD list is not pertinent to the question.
Indeed, LeoCAD is the only one of the three I talked supra that has no problem finding .dat files as they are distributed now. The problem raised on the LeoCAD list was only about its assumptions about LDConfig.ldr. The state of the library was a follow-up.

Sorry if my tone is harsh but “we don’t care about programs and systems we don’t use” is rude too.


Re: Lower-casing the library - Sylvain Sauvage - 2015-09-18

Chris Dee Wrote:If you mean
LDraw.org Wrote:All files in the LDraw Parts Library are required to carry the .DAT extension.
then I think this is a typo, because later in the same article it uses .dat

The 512 article says just above the .DAT (my emphasis):
Quote:While both upper and lower case letters are permitted in filenames, filenames are case-insensitive. Currently, all official parts are issued with upper-case only names.



Re: Lower-casing the library - Roland Melkert - 2015-09-18

Sylvain Sauvage Wrote:For the other main programs I know of (MLCAD, LDCAD, etc.), either they are Windows only, and the question doesn’t arise (ditto in Wine), or closed-source, and I won’t know.
LDCad does full path case insensitive lookups in both the Windows and Linux versions. This is done by caching the file listings of all needed target folders. It is needed even on Windows as it also gives you the correct casing when the reference was wrong.

So for example even a reference like: mEsSEd/uP/fILenAme/rEf.dAT will resolve to e.g. messed/up/fileName/ref.dat

Only possible problem on case sensitive file systems will be when there are different cased versions of the same file present, in such cases the first one will 'win'.


Re: Lower-casing the library - Travis Cobbs - 2015-09-18

Sylvain Sauvage Wrote:LDView:
Tries all-lower, then all-upper, then as-is, then fails.
The filenames include the paths. So if the files are somewhere like ~/Documents/LDraw/…, only the as-is versions could be found. A lot of LDraw official parts wouldn’t because of the internal mess of the library.
Sum-up: trivially fails.

LDView's file case handling is platform-specific. The Qt version should support any file case (unless the implementation is buggy), is written using Qt filesystem classes, and is slow. The Qt code is in ModelViewerWidget:ConfusedtaticFileCaseCallback(). The other versions (including the OSMesa version) don't properly support arbitrary case on a case-sensitive file system.


Re: Lower-casing the library - Sylvain Sauvage - 2015-09-18

Yes, sorry, I hadn’t tracked the setting of the callback (and the callback code).

So, I amend with:
LDView:
Tries all-lower, then all-upper, then as-is, then globbing.
Sum-up: wonderfully not trivial. And not fast.


Re: Lower-casing the library - Nathanel Titane - 2015-09-19

Well not to mention that I ran into this issue with LDConfig.ldr at some point when using both LDView and ldview: things weren't functioning as the utilities weren't functioning properly due to the file's upper case naming scheme.

I personally have mine lower case on my system (Linux) and have kept it that way ever since.

Since the DOS spec is no longer relevant and since case specific lookups are a hassle, it would definitely be a good idea to brush up the spec to have the library go lower case or insensitive.