PDA

View Full Version : Display a message before deleting/renaming a file.




ithil
Jul 10, 2006, 03:50 AM
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
Jul 20, 2006, 03:15 AM
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
Jul 20, 2006, 11:54 AM
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
Jul 21, 2006, 04:14 AM
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..