[R-SIG-Mac] Word / OS X / R
David Winsemius
dwinsemius at comcast.net
Tue Sep 13 00:26:32 CEST 2011
On Sep 12, 2011, at 2:43 PM, Dennis Fisher wrote:
> R 2.13.1
> OS X. 10.6.8
> Colleagues,
>
> I just encountered an interesting Word / OS X / R interaction
> problem. Situation is:
> 1. I have an open RTF file
> 2. From R:
> a. I delete the file (confirmed)
> b. I create a new RTF file with the same name (successfully)
> c. I attempt to open the new RTF file
> Word hangs (a recursive message that it can't open the file -- it
> must be corrupt), presumably because the original file was open in
> Word, despite being deleted from the drive.
Sounds more like a Microsoft error. File locking (or lack thereof)
varies across OSes. BSD is more permissive than System V. It is not
the default on BSD Unix.
>
> Any ideas on how to solve this? Is there some method (from R or
> from the OS) to detect which files Word has open? If so, I could
> avoid creating the new file if the original one was open.
> Interestingly, I presume that this would not happen in Windows
> because step 2a could not happen if the file were open.
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/
ManPages/10.5/man2/flock.2.html
I suppose you need to determine by experimentation whether MS-Word
sets any flags that system utilities can access.
> Dennis
>
--
David Winsemius, MD
West Hartford, CT
More information about the R-SIG-Mac
mailing list