A quick question : is it possible to know the permission before store a file ?
I have a lot of application, and one of them write a qvd file and others read this file. But I have a problem when the qvd file is read by an application. The application which want to update the qvd file, crash, because it does not have the permission. So my idea is to test the qvd file and if it is not possible to write it, I add a sleep.
I think the problem is that when the file is read by another application that application places a file lock on it. The result is that it's then not possible for another application to write to the file. You need to make sure that the reading application has only read-only access to the qvd and can't place a file lock on it.
You could try having the reading applications write a code to another file and removed it when it's done. The writing application could check for this file and wait until it gets the all-clear. See here for a way to do that.