Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 10, 2006, 03:50 AM   #1
ithil
macrumors newbie
 
Join Date: Jul 2006
Display a message before deleting/renaming a file.

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...
ithil is offline   0 Reply With Quote
Old Jul 20, 2006, 03:15 AM   #2
slooksterPSV
macrumors 68030
 
Join Date: Apr 2004
Location: Nowheresville
Send a message via AIM to slooksterPSV Send a message via MSN to slooksterPSV Send a message via Yahoo to slooksterPSV
Quote:
Originally Posted by ithil
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.
__________________
AMD Phenom 9600, 2GB RAM, 250GB HDD, ATI Radeon 4850, Vista Home Premium 64-bit
Gateway NV53 with Windows 7 Home Premium 64-bit & Ubuntu 10.04 Lucid Lynx 64-bit
slooksterPSV is offline   0 Reply With Quote
Old Jul 20, 2006, 11:54 AM   #3
savar
macrumors 68000
 
savar's Avatar
 
Join Date: Jun 2003
Location: District of Columbia
Send a message via AIM to savar
Quote:
Originally Posted by ithil
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.
__________________
Mehce
savar is offline   0 Reply With Quote
Old Jul 21, 2006, 04:14 AM   #4
ithil
Thread Starter
macrumors newbie
 
Join Date: Jul 2006
Quote:
Originally Posted by savar
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..
ithil is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Renaming of file extensions in Textedit thecork OS X Mavericks (10.9) 8 Oct 2, 2013 10:40 AM
"Browse All Versions" broken after moving or renaming the file? NazgulRR OS X 10.8 Mountain Lion 2 Jun 28, 2013 02:52 PM
having a file renaming issue, help? zoobaaruba Mac Basics and Help 1 Jan 12, 2013 07:38 PM
Mail notifications not disappearing on iPod after deleting message on MacBook myrtlebee iOS 6 10 Jan 12, 2013 09:28 AM
Finder Drag and Drop ordering behavior changed (for file renaming) Milquetoast OS X 10.8 Mountain Lion 0 Dec 29, 2012 10:05 AM

Forum Jump

All times are GMT -5. The time now is 08:37 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC