raspberrypi / scratch

Scratch releases
79 stars 21 forks source link

Try to ensure file data is really, really, flushed to SD card when writing Scratch projects #196

Closed timrowledge closed 8 years ago

timrowledge commented 8 years ago

See https://www.raspberrypi.org/forums/viewtopic.php?f=77&t=148349

Basically it appears the power sometimes gets pulled a bit ... enthusiastically... in classrooms. Since *nix is convinced it knows best, file buffers are not always flushed after writing, nor even necessarily as part of closing a file, so add call to flush and sync as part of writing the project files.

timrowledge commented 8 years ago

We have a primitiveFileSync in the FilePlugin code so add a call to the prim and a nice method in StandardFileStream to use it. Modify the project writing code to flush, sync and then close. I don't think there is any more agressive way to force it; an axe, maybe?

timrowledge commented 8 years ago

Fixed in Scratch-tpr-341 ready for next release