Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ithil

macrumors newbie
Original poster
Jul 2, 2006
5
0
Hi all,

If I try to delete ( by emptying trash) a XCode project, when it is open, it will display a message [The operation cannot be complete because the item "main.m" is in use] & trash is not emptied.

I want to display a similar error message if my application is trying to delete/rename a file, which is used by other application. Is there a way to provide such a behaviour?

Thanks... :)
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
ithil said:
Hi all,

If I try to delete ( by emptying trash) a XCode project, when it is open, it will display a message [The operation cannot be complete because the item "main.m" is in use] & trash is not emptied.

I want to display a similar error message if my application is trying to delete/rename a file, which is used by other application. Is there a way to provide such a behaviour?

Thanks... :)
Now, someone correct me if I'm wrong, but when you open a stream to a file it registers as being open, now it is possible to test whether there is a stream going into or out of that file based on its location? ID? something? There are many programs that do this, so it is possible - you may want to search for file isopen command or something.
 

savar

macrumors 68000
Jun 6, 2003
1,950
0
District of Columbia
ithil said:
If I try to delete ( by emptying trash) a XCode project, when it is open, it will display a message [The operation cannot be complete because the item "main.m" is in use] & trash is not emptied.

You can't delete a file that is open for writing. That's why the trash gives you that message.

If you want your app to give the same message, open the file for writing.
 

ithil

macrumors newbie
Original poster
Jul 2, 2006
5
0
savar said:
You can't delete a file that is open for writing. That's why the trash gives you that message.

If you want your app to give the same message, open the file for writing.

I guess i could have done that..:) thanks for your time..
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.