LODocumentSaveToFile requires a path, not just a file name


#1

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.


#2

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:


#3

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


#4

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


#5

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


#6

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


#7

@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.


#8

Got it. Thanks, Dan.


#9

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