LODocumentSaveToFile requires a path, not just a file name

LODocumentSaveToFile appears to be unable to take in a filename without path information. For example, LODocumentSaveToFile(document, "test.layout", LODocumentVersion_Current) returns a SU_ERROR_SERIALIZATION. This is an odd counterpoint to SUModelSaveToFile which does work with just a filename. At the very least, this should be noted in the documentation, if not changed to work as you would expect.

1 Like

We would expect filenames and relative paths to work from the current working directory.
If beginning with “\” or “/” we’d expect relative to the root of the current drive.
Absolute paths should absolutely work. :wink:

They do, as do relative paths. It is just filenames that do not work it seems.

1 Like

Ah so, you need to precede filenames with ".\" or "./" ? (That is a bit weird.)

Yup, that is what it seems like from my testing.

Thanks for bringing this to our attention. We’ll take a look at what’s involved in getting LODocumentSaveToFile to work with relative paths.

@JeremyWalker, actually as reported absolute and relative work, but just plain filenames do not work on the current working directory. (Which is weird.)

So the workaround is to use "./filename.layout" as an argument (which is a relative path,) but is a quirky kind of thing to be required.

Got it. Thanks, Dan.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.