Lower-casing the library


Lower-casing the library
#1
My attention was drawn to this topic by a post by Sylvain Sauvage on LeoCAD list:
Code:
I just realized that Leocad tries to open “ldconfig.ldr”.
The problem is the file is named “LDConfig.ldr” so it’s not
found on case-sensitive filesystems (that means about every
decent FS ;o).
Not a big problem as the default color palette is up to date
but, still, worth knowing IMHO.
Code:
[quote]
I thought all files in the LDraw library were supposed to be lower case.
[/quote]
  Parts files and directories are. LDConfig.ldr isn’t. (And .txt files aren’t either.)
  I didn’t find any reference to case sensitivity in the LDR file format. I only found that for the Official Library
(http://www.ldraw.org/article/512.html):
  “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.”
and that is contradicted by the fact that the ZIP file uses lower-case only names.

  Plus, “internally,” the library isn’t consistent, .dat files refer to others as:
— low.dat
— UP.DAT
— UP.dat
— low.DAT
— and a few have MiXeD-cAsE references
I think we should do something to clean up this in library, and also correct article 512...
Reply
Re: Lower-casing the library
#2
That would be a good idea.
Reply
Re: Lower-casing the library
#3
As you know LDraw references are case insensitive as far I know this includes the reference to LDConfig.ldr.

Does LeoCAD handle all references by simply lower casing them? if so lowercasing the library will not fix all possible problems.

The only way it will be fixed for real, imho, is if LeoCAD did real caseinsensitve lookups.
Reply
Re: Lower-casing the library
#4
Lower case is a good idea. I just noticed the same problem in a unrelated project.
Reply
Re: Lower-casing the library
#5
Not sure what you mean with this?
Reply
Re: Lower-casing the library
#6
I meant to say that the case shouldn't matter from LeoCAD's point of things as the references should be handled case insensitive anyway.

But I misread your main point on the default casing of official files.

On that I agree it should be all lower case all the time as all caps is very ugly especially for extensions. Could it be possible that the 512 article is just an typo as I can't remember ever seeing all caps in official files.

As for LDConfig.ldr I think we should keep that case unchanged as it is an configuration file with known casing probably hardcoded in some programs here and there.
Reply
Re: Lower-casing the library
#7
Roland Melkert Wrote:On that I agree it should be all lower case all the time as all caps is very ugly especially for extensions. Could it be possible that the 512 article is just an typo as I can't remember ever seeing all caps in official files.

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
Chris (LDraw Parts Library Admin)
Reply
Re: Lower-casing the library
#8
It's trivial to program for case insensitivity and decent programs account for this. The official library standard implies it for filenames so maybe we should revise the file spec to require it as well. Also, I might point out that LeoCAD is not an LDraw compatible program but merely has the ability to import LDraw files.
Reply
Re: Lower-casing the library
#9
Agreed, but for the sake of homogeneity I would like too to see the whole parts library converted to lower case (file name and references). But Roland has a point with LDConfig.ldr that has always been capitalized this way.

Quote:Also, I might point out that LeoCAD is not an LDraw compatible program but merely has the ability to import LDraw files.
Used to be true in a time when LeoCAD used its own library file format, but that's no longer the case, LeoCAD now uses plain LDraw library (either zipped or in a folder).
Reply
Re: Lower-casing the library
#10
Actually, that's not exactly true. It's not rocket science, but it's also not as trivial as one might imagine. Additionally, LDView runs significantly slower when the LDraw library is installed on a case-sensitive filesystem, because you have to actually search for the right file after the initial open attempt fails.
Reply
Re: Lower-casing the library
#11
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.
Reply
Re: Lower-casing the library
#12
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.
Reply
Re: Lower-casing the library
#13
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.
Reply
Re: Lower-casing the library
#14
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'.
Reply
Re: Lower-casing the library
#15
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.
Reply
Re: Lower-casing the library
#16
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.
Reply
Re: Lower-casing the library
#17
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.
Industrial Design, Linux, Lego.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)