seldon-code / seldon

A code for opinion dynamics simulations.
GNU General Public License v3.0
7 stars 2 forks source link

ENH: Update main.cpp #49

Open User-DK opened 4 months ago

User-DK commented 4 months ago

This update ensures that there are no inconsistencies when the ouput directory has already been build then it just doesn't appends but first removes and then writes to the output directory.

Tests Passed: Yes

MSallermann commented 4 months ago

It's definitely a good idea to improve the consistency of repeated runs!

I wonder if this behavior might be a bit unsafe though. Given sufficient user error, it might lead to unintentional deletions of arbitrary directories.

Maybe the default should be to just abort the run if the output directory already exists and is not empty.

We could implement "force" flag -f to optionally remove the output directory before the run. What do you think?

User-DK commented 4 months ago

Yes actually, might be a error saying that the output directory exists would also have been sufficient, and deleting without the user consent is also a wrong behaviour so, we can just make it to throw error if output directory already exists and is not empty. So that user can take the further step whether to delete the directory or to make another directory. Is that fine ?