diff options
| author | Teddy Wing | 2018-10-22 21:02:02 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2018-10-22 21:02:02 +0200 | 
| commit | e0441420ac9d5deee4c8c8423b20258ab2f01f60 (patch) | |
| tree | 5a084cc0efe33e4661388d73ea5edb8b70054b9a /src/errors.rs | |
| parent | 26156433c51cdcfa175c41de28c11828eb78c2eb (diff) | |
| download | dome-key-map-e0441420ac9d5deee4c8c8423b20258ab2f01f60.tar.bz2 | |
initialize_trial_start(): Don't rewrite the file if it already exists
The `File::open` function will truncate the file if it exists already:
> This function will create a file if it does not exist, and will
> truncate it if it does.
(https://doc.rust-lang.org/std/fs/struct.File.html#method.create)
We don't want this behaviour, as the file should only be created &
initialised a single time. The trial timestamp should always correspond
to the first trial launch of the program. It doesn't do us any good if
the file is overwritten by DomeKey and updates the trial start time to a
more current value.
Thanks to 'sarnold' (https://stackoverflow.com/users/377270/sarnold) on
Stack Overflow for the clean pattern matching code to match the
`std::io::ErrorKind::AlreadyExists` error:
https://stackoverflow.com/questions/28491759/matching-on-a-specific-error-type/43884600#43884600
Diffstat (limited to 'src/errors.rs')
0 files changed, 0 insertions, 0 deletions
