Issue#935

Final Jenkins testrun:
https://jenkins.catrob.at/view/All-Categories/view/Catroid-multi-job/job/Catroid-Multi-Job-Custom-Branch/1924/

Process How Files are getting saved (in order to avoid data loss):
You have 3 steps. During/Before/After the first 2 steps (The renaming should be atomic on Linux/Android) an error can occur, this will be checked within the SanityCheckFunction().

-- Filestate: code.xml
1. Write to tmp_code.xml            
-- Filestate: code.xml tmp_code.xml   
2. Delete code.xml
-- Filestate: tmp_code.xml   
3. (usually atomic) rename tmp_code.xml    --> code.xml
-- Filestate: code.xml

@aried3r 
No, the tmp file will never exist after a normal saveProject operation as it gets renamed immediately. (exception: process was interrupted) 

We verify the case that only a functioning tmp file exists (the real code.xml was deleted manually just before calling saveProject()) and now the sanityFunction recognize this case and restores the tmp_code.xml to a code.xml.