Closed benjamin-heasly closed 11 years ago
On second thought, maybe errors really are different from control-C. Maybe it is sufficient to have BatchRender() cd() back to its original folder following errors, but stay where it was following a user control-C.
When Issue #22 is resolved, it should be possible for BatchRender() to cd() to a sensible location first, so that the behavior would not depend on where it happened to leave off the first time.
This assumes that a custom location is specified, or that pwd() is resolved, before entering BatchRender().
de42ecb9a0eddd42dcb308d9f0b88cc8113496e0 fixes this. BatchRender() doesn't do any cd() of its own.
When there's a BatchRender() error, or when the user aborts with control-C, Matlab ends up in an intermediate temp folder. Then next time BatchRender() runs, it tries to copy a file from the temp folder to the temp folder, and fails.
This is irritating. It could check the source and destination folders and not try to copy when they are the same.
But BatchRender() probably should never start out in the temp folder. So either it should have a way to cd() back to its original folder, or it should have an absolute path to always start from.
Matlab allows a cleanup function to be invoked upon error and upon control-C (try/catch does not catch control-C): http://www.mathworks.com/help/matlab/ref/oncleanup.html But I think this is a 2012b feature, and users should not have to depend on it.
So the practical solution is for BatchRender to default to an absolute path, instead of pwd(). Users could still choose a folder with hints.