Feature Better file corruption support

Irrat

Member
A corrupt file sometimes has long lines of 0 bytes, caused by the writer being interrupted as the data is being written.
When half the settings are written properly, the current check will not detect corruption.

But it may be possible for settings to contain null bytes. I'm getting a headache thinking about this, if someone wants to take a shot at it.

Basically, I was thinking as a basic level of support, 10 null bytes in a row = corrupt file.

Also, possibly on top of the existing .bak, integrate the "parse session and restore preferences from it" from kolfix into mafia proper.
I think it'll only work if the preferences are logged, but better than nothing. It'd be nice to have this automatically handled.

Another thought is to check if some preferences are missing. If a hardcoded preference is missing, it's assumed corrupted. Maybe with a null bytes check.
 
Back
Top