Saving a file character stream to a UNC path not reporting a failure to save the file
Hey everyone.
I have a process where I create a new %Stream.FileCharacter object, specify the filename (including it's path), write data to the stream, and then save. However for some reason, if the user account does not have write access to the directory, the %Save method is still returning true even though it was unable to actually write the file to the folder.
The location is a UNC path, and I'm wondering if this is tripping me up?
Checking status codes is a good starting point...
Your %Save() returns with 1 (OK), because there is nothing to save...
Note: on linux, for a standard user (like me now) is forbidden to write to '/root' directory
Ahh that explains where I went wrong, thanks!
In my mind, the write action was writing the data to the object while it was still server-side, and then it was the save that actually commits it to the destination, which is why I was only looking at the status of the save method.
Of course, if you don't want to check each and every write() for error or success, you can do the check just one time at the beginning
writing a nullstring to stream does not change the stream but the file opening sequence will be executed