Filepath Backslash(\) or Forwardslash(/)


Filepath Backslash(\) or Forwardslash(/)
#1
All the documentation I found used backslashes(\) for filepaths e.g "s\subpart.dat". But I could not find if forward slashes(/) are also allowed. LDView can use either without any errors, while LDPe does show an error. If either both or only backslashes are allowed it should be mentioned in the Documentation either under filename or a new section. I do ask this because in ConvertToLDraw I currently use forward slashes and I got this Bug report. I will change the filepaths if they are out of spec.
Reply
RE: Filepath Backslash(\) or Forwardslash(/)
#2
Bricklink Studio also supports both b.t.w.
Reply
RE: Filepath Backslash(\) or Forwardslash(/)
#3
(2025-08-18, 16:08)Hageta Wrote: Bricklink Studio also supports both b.t.w.

It's a little known fact that Windows supports / as a path separator in most places. So programs have to add extra code to not accept / in place of \. (The Windows command line is one place where / gets special treatment, making it not usually work as a path separator.)

All official parts are required to use \ as their path separator (for s\ and 8\ and 48\). But programs have to add extra code to disallow /, and it seems like I didn't do that in LDView. (It's been over two decades since that code was written, so I honestly don't remember the details.)
Reply
RE: Filepath Backslash(\) or Forwardslash(/)
#4
Backslash is required. Forwardslash is not allowed. It may or may not be clear from the documentation, but you will get an error if uploading to the parts tracker.
Reply
RE: Filepath Backslash(\) or Forwardslash(/)
#5
Just a clarification to the comments here:

Per the file format spec, either is allowed (i.e. any valid, relative path for your OS).

Per the LDraw Library standard (i.e. Official Library parts), only backslash is allowed
Reply
RE: Filepath Backslash(\) or Forwardslash(/)
#6
I did change it to backslash in case somebody wants to create official parts. But I still can not find this in the documentation.
Reply
RE: Filepath Backslash(\) or Forwardslash(/)
#7
You're right.  While heavily implied via the examples, it is never explicitly stated.

In another thread I mention I've been working on a documentation overhaul. I checked and I have explicitly stated in my draft so it will be addressed when the new doc format is released.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)