Filenames


RE: Filenames
#5
(2024-01-09, 10:11)Toby Nelson Wrote: Thanks for that clarification, that's good to know.

To answer my own questions:
1. (For texmap filenames) Are these sentences referring to quoted filenames specifically, or all filenames?
Quoted filenames specifically. Non-quoted texmap filenames are always treated literally, terminating in the end of the line or whitespace ( tab(9) or space(32) ).

Actually, the first sentence in that paragraph (about putting quotes around filenames with spaces) stands alone. Nothing else in the sentence is dependent on it. So quotes and backslashes anywhere in the filename always need to be escaped with a backslash.

(2024-01-09, 10:11)Toby Nelson Wrote: 2. (For quoted filenames) should the backslash "escape character" work with characters other than " and a second backslash or just those two?
Let's say yes it should work with other characters, (as this often is how escape characters work in other contexts)

No, only double quote and backslash are supported.

(2024-01-09, 10:11)Toby Nelson Wrote: 3. The main spec page is even fuzzier about filenames - no mention of spaces or quoting. Is it allowed, disallowed, discouraged?
Filenames in this context (i.e. not texture map filenames) are interpreted literally, so quotes and spaces have no special meaning - they are regular characters in the filename, and there is no escape character. Basically everything up to the end of the line is a filename, but with whitespace trimmed at each end.

Spaces are allowed in model reference lines, and quoting of filenames is not allowed. Everything from the first character of the model reference filename to the end of the line should be treated as the filename. I believe that the quote wrapping for TEXMAP was done purely so that other tokens could be added after the filename, and that has never been an issue with model filenames.

(2024-01-09, 10:11)Toby Nelson Wrote: 4. The use of the phrase 'such as' lacks clarity: which characters should be discouraged and which are fine?
All UTF-8 characters are allowed. However, filing systems in different operating systems have their own restrictions on the characters allowed in filenames, and other characters create problems for URLs. So for compatibility reasons these should be avoided. In particular the characters below can cause problems:
< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
? (question mark)
* (asterisk)
& (ampersand)
# (hash)
| (vertical bar or pipe)

Filenames for both textures and model references (outside library parts) are chosen by the end user. As such, we have to assume that they will choose anything that their operating system allows them to choose. So adding to what is already there (along with separate parts library filename restrictions) is counter-productive. Note that both forward and backward slash characters in all filenames must both always treated as directory separators by LDraw-compliant software. As for the others, most should actually work fine. Colon won't work on Windows (and probably also not on Mac). Some of the others cause problems on a command line due to shell interpretation, but that shouldn't affect software that is reading the files.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Filenames - by Toby Nelson - 2024-01-08, 21:02
RE: Filenames - by Orion Pobursky - 2024-01-08, 21:32
RE: Filenames - by Roland Melkert - 2024-01-08, 21:56
RE: Filenames - by Toby Nelson - 2024-01-09, 10:11
RE: Filenames - by Travis Cobbs - 2024-01-09, 17:06
RE: Filenames - by Toby Nelson - 2024-01-10, 10:58
RE: Filenames - by Toby Nelson - 2024-01-10, 11:23
RE: Filenames - by Travis Cobbs - 2024-01-12, 1:40
RE: Filenames - by Toby Nelson - 2024-01-12, 15:01
RE: Filenames - by Orion Pobursky - 2024-01-12, 16:51
RE: Filenames - by Travis Cobbs - 2024-01-10, 18:01
RE: Filenames - by Roland Melkert - 2024-01-10, 23:03
RE: Filenames - by Toby Nelson - 2024-01-11, 12:19
RE: Filenames - by Roland Melkert - 2024-01-11, 22:38
RE: Filenames - by Toby Nelson - 2024-01-14, 8:41

Forum Jump:


Users browsing this thread: 2 Guest(s)