[WIP] Throw Exception if results directory cannot be created or file cannot be written#2188
[WIP] Throw Exception if results directory cannot be created or file cannot be written#2188
Conversation
… be written. Fixes #2181.
chrisdembia
left a comment
There was a problem hiding this comment.
Would it make sense to put the check OPENSIM_THROW_IF(errno == ENOENT, UnableToCreateDirectory, aDir); inside IO::makeDir()?
|
The line number in this exception from the AppVeyor log is suspicious: Exception:
4466 Unable to create directory 'twoMusclesOnBlock_ResultsCMC'.
4467 Thrown at CMCTool.cpp:831 in run().
4468 line= 1978645904I don't think any of our source code files have that many lines. |
|
@aseth1 Do you want these exceptions thrown from IO.cpp instead |
I added the |
It depends what you mean by "would it make sense". The current interface of opensim-core/OpenSim/Common/IO.cpp Lines 467 to 470 in 671076b so it seems like the problem is that the callers are ignoring the return value/error condition, not that makeDir() has been implemented incorrectly.
|
Fixes #2181.
Brief summary of changes
errno == ENOENTif results directory cannot be created.Testing I've completed
Ran example setup file that attempted to write results to
C:\Program Files:InverseKinematicsTool Failed: Storage: Failed to open file 'C:\Program Files/ik_marker_errors.sto' for writing. Verify that the destination directory is writable. Thrown at Storage.cpp:2746 in print().Looking for feedback on...
CHANGELOG.md (choose one)
The Doxygen for this PR can be viewed at https://umn6cx1r7upd7tt8dax209m1cr.julianrbryant.com/?C=N;O=D; click the folder whose name is this PR's number.
This change is