save file corruption? is it an issue? if so how do you deal with it?

File corruption may not be a practical issue for everyone. I personally have never had my apps save file become corrupted but I still have a procedure in place to deal with it.

I am wondering what peoples experiences and approached are?

Here is my procedure:

I make a md5 hash of the data then write it at the end of the file. When I load 

the file I read in the data do a md5 hash and compare it to whats in the file.

Also, I have a back upfile written each time the file is saved. Since a crash of the device could potentially interrupt the writing. With two files there would always be something to restore from (even if one is a slightly older version).

I’ve never heard of any one running into corruption once you’re past testing so I generally only look to see if I have the file or not, but your system seems reasonable.

I’ve never heard of any one running into corruption once you’re past testing so I generally only look to see if I have the file or not, but your system seems reasonable.

I am in a similar sitaution. Deciding if I should write JSON file or save JSON as blob in sqlite. If I just write to a JSON document is this atomic? I do not want to only have half my data save if an error occurs.

I would say saving to a flat file is a safer action, in particular if it’s a small file than writing to a database.

Rob

I am in a similar sitaution. Deciding if I should write JSON file or save JSON as blob in sqlite. If I just write to a JSON document is this atomic? I do not want to only have half my data save if an error occurs.

I would say saving to a flat file is a safer action, in particular if it’s a small file than writing to a database.

Rob