svalinn / Cubit-plugin

Plugins and command extensions for Coreform Cubit
BSD 3-Clause "New" or "Revised" License
17 stars 14 forks source link

Report failure if file isn't successfully written #150

Open pshriwise opened 1 year ago

pshriwise commented 1 year ago

We've seen a couple of cases on OSX where the working directory of the Cubit application is / or some other location that isn't writeable for the user. In this case the plugin will either cause Cubit to crash or finish without writing the file, neither of which are desirable behavior if we fail to write the DAGMC file.

MicahGale commented 1 year ago

This error should occur ASAP IMO. A helpful error message and crash after a long execution is barely more useful than no error message at all. As soon as the file location is known something simulating touch should be done to verify write permissions.

pshriwise commented 1 year ago

Agreed. I'm betting there's a convention for handling this within Cubit either by detecting permissions of the output directory through the OS or writing a test file as you suggested.