Hi.
I found a strange (but desired) thing. I can overwrite a GRASS raster
layer which is open in QGIS on Windows (NTFS). It should not be possible
because it is not possible to delete/move a file which is open
by another application on Windows. And AFAIK it was not possible some
month ago.
Now I can overwrite an open raster without problems on XP Professional SP2.
I cannot delete the file from file manager but I can see that the time
was updated
if a GRASS module was run!!!
Can you confirm, explain?
Radim
The status after OPEN request in Filemon is 'SHARING'.
So it seems that CopyFile() can overwrite a file which is used
by another program. I thought that impossibility to delete
a file is Windows/NTFS, but it is probably only on application
level. Interesting.
Radim
On 11/28/06, Radim Blazek <radim.blazek@gmail.com> wrote:
Hi.
I found a strange (but desired) thing. I can overwrite a GRASS raster
layer which is open in QGIS on Windows (NTFS). It should not be possible
because it is not possible to delete/move a file which is open
by another application on Windows. And AFAIK it was not possible some
month ago.
Now I can overwrite an open raster without problems on XP Professional SP2.
I cannot delete the file from file manager but I can see that the time
was updated
if a GRASS module was run!!!
Can you confirm, explain?
Radim
Radim Blazek wrote:
The status after OPEN request in Filemon is 'SHARING'.
So it seems that CopyFile() can overwrite a file which is used
by another program. I thought that impossibility to delete
a file is Windows/NTFS, but it is probably only on application
level. Interesting.
The documentation for CopyFile() isn't clear on this point, but it may
be that it simply overwrites the contents of the existing file, rather
than replacing the file.
The documentation says:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/copyfile.asp
: bFailIfExists
: [in] If this parameter is TRUE and the new file specified by
: lpNewFileName already exists, the function fails. If this
: parameter is FALSE and the new file already exists, the function
: overwrites the existing file and succeeds.
The term "overwrites" is ambiguous in this context.
Note that MoveFile() doesn't have an equivalent flag; the
documentation for that says:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/movefile.asp
: pNewFileName
: [in] Pointer to a null-terminated string that specifies the new
: name of a file or directory. The new name must not already exist.
IOW, it appears that MoveFile() is primarily an operation on the
filesystem (analogous to Unix' rename()), while CopyFile() is an
operation on the files themselves (Unix doesn't have any direct
equivalent).
--
Glynn Clements <glynn@gclements.plus.com>