I once did this the "Office" way. Whenever I opened a file for writing I renamed it to
"¬".$file or so. If I opened it for reading I would check both filenames. Once editing was finished it got renamed to the old filename again. This surely requires some limitations and a filename was not allowed to use some special characters for a first character.