Re: Is a file open in another application?

2011-03-20 Thread Kyle Sluder
On Sun, Mar 20, 2011 at 11:59 AM, Quincey Morris wrote: > Second, if you're providing a list, you'll have to make sure that you know > where to find the *current* (i.e. last saved) version of the file, in case > the file gets saved since the list was constructed. In many cases, the file > syste

Re: Is a file open in another application?

2011-03-20 Thread Quincey Morris
On Mar 20, 2011, at 06:28, Brad Stone wrote: > After sleeping on it my choices are to remove the encryption feature or make > a big ugly dialog box warning the user if they encrypt a file that's open > they will lose their changes. Neither of these approaches are optimum. On Mar 20, 2011, at 1

Re: Is a file open in another application?

2011-03-20 Thread Brad Stone
Actually, the users are shown files in a NSTableView and they select a menu to encrypt/decrypt. That's where I'll warn them. Thanks for your suggestion. On Mar 20, 2011, at 10:10 AM, Robert Martin wrote: > Given all the problems I've seen raised in this thread, I was just thinking > that you

Re: Is a file open in another application?

2011-03-20 Thread gweston
Brad Stone wrote:   On Mar 19, 2011, at 11:04 PM, Brad Stone wrote: I do need it to work for any app, not just Word or XL.   I guess a poor workaround would be since it's not possible to reliably check if the file is open> I can force the user to quit the file's default app before allowing them

Re: Is a file open in another application?

2011-03-20 Thread Steve Bird
On Mar 20, 2011, at 9:28 AM, Brad Stone wrote: > After sleeping on it my choices are to remove the encryption feature or make > a big ugly dialog box warning the user if they encrypt a file that's open > they will lose their changes. Neither of these approaches are optimum. Are you sure you n

Re: Is a file open in another application?

2011-03-20 Thread Brad Stone
After sleeping on it my choices are to remove the encryption feature or make a big ugly dialog box warning the user if they encrypt a file that's open they will lose their changes. Neither of these approaches are optimum. On Mar 19, 2011, at 11:04 PM, Brad Stone wrote: > I do need it to work f

Re: Is a file open in another application?

2011-03-19 Thread Brad Stone
I do need it to work for any app, not just Word or XL. I guess a poor workaround would be since it's not possible to reliably check if the file is open I can force the user to quit the file's default app before allowing them to encrypt. It's just kind of heavy-handed. On Mar 19, 2011, at 6:20

Re: Is a file open in another application?

2011-03-19 Thread Charles Srstka
On Mar 19, 2011, at 1:40 PM, Conrad Shultz wrote: > On 3/19/11 11:10 AM, Kyle Sluder wrote: >> On Sat, Mar 19, 2011 at 9:13 AM, Conrad Shultz >> wrote: >>> Note that this will only capture files that are properly opened (i.e. >>> fopen()'d), so you won't catch every apparently open file. For exa

Re: Is a file open in another application?

2011-03-19 Thread Dave Keck
> Is there a way for me to tell if a particular file is open in another > application? The following thread offers one solution: http://www.cocoabuilder.com/archive/cocoa/288040-notification-of-file-system-modification-arrives-too-early.html which might be worth using if proc_listpidspath(

Re: Is a file open in another application?

2011-03-19 Thread Scott Ribe
On Mar 19, 2011, at 1:58 PM, Frédéric Testuz wrote: > I can't think of a general solution, but IIRC Brad is only interested about > Word and Excel. These applications have AppleScript support. > > I'm sure he can ask Word by AppleScript for the open documents. He had to > check if Word can also

Re: Is a file open in another application?

2011-03-19 Thread Frédéric Testuz
Le 19 mars 2011 à 20:03, Kyle Sluder a écrit : > On Sat, Mar 19, 2011 at 11:40 AM, Conrad Shultz > wrote: >> Are you certain that is a general behavior? > > 1. Open TextEdit. > 2. Type some stuff. > 3. Save As > /tmp/somefile.rtf > 4. `lsof |grep somefile` prints nothing. > >> For example, I ha

Re: Is a file open in another application?

2011-03-19 Thread Scott Ribe
On Mar 19, 2011, at 12:40 PM, Conrad Shultz wrote: > For example, I have Preview open right now, and it very much lists all > its open files: And I have Preview open right now, and it does not have any of its files open. This is on 10.6.6, Preview 5.0.3. Further, I can tell you that some older

Re: Is a file open in another application?

2011-03-19 Thread jonat...@mugginsoft.com
On 19 Mar 2011, at 13:34, Brad Stone wrote: > Is there a way for me to tell if a particular file is open in another > application? > > I have a feature I'd like to provide to my users that involves encrypting > files that belong to other apps (i.e. my application can encrypt/decrypt a > Word

Re: Is a file open in another application?

2011-03-19 Thread Kyle Sluder
On Sat, Mar 19, 2011 at 11:40 AM, Conrad Shultz wrote: > Are you certain that is a general behavior? 1. Open TextEdit. 2. Type some stuff. 3. Save As > /tmp/somefile.rtf 4. `lsof |grep somefile` prints nothing. > For example, I have Preview open right now, and it very much lists all > its open f

Re: Is a file open in another application?

2011-03-19 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 3/19/11 11:10 AM, Kyle Sluder wrote: > On Sat, Mar 19, 2011 at 9:13 AM, Conrad Shultz > wrote: >> Note that this will only capture files that are properly opened (i.e. >> fopen()'d), so you won't catch every apparently open file. For example, >> i

Re: Is a file open in another application?

2011-03-19 Thread Kyle Sluder
On Sat, Mar 19, 2011 at 9:13 AM, Conrad Shultz wrote: > Note that this will only capture files that are properly opened (i.e. > fopen()'d), so you won't catch every apparently open file.  For example, > if you open a file in vi(m), it creates a hidden scratch file in the > same directory and close

Re: Is a file open in another application?

2011-03-19 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 (Copying the list this time...) On 3/19/11 6:34 AM, Brad Stone wrote: > Is there a way for me to tell if a particular file is open in another > application? > > I have a feature I'd like to provide to my users that involves > encrypting files that be

Is a file open in another application?

2011-03-19 Thread Brad Stone
Is there a way for me to tell if a particular file is open in another application? I have a feature I'd like to provide to my users that involves encrypting files that belong to other apps (i.e. my application can encrypt/decrypt a Word or Excel file). I want to prevent the user from encryptin