Re: Core Data Backup on App Start
Re: Core Data Backup on App Start
- Subject: Re: Core Data Backup on App Start
- From: Marco Masser <email@hidden>
- Date: Fri, 25 Jul 2008 00:07:49 +0200
I have a boolean set for my preferences to check whether the user
wants to backup the database at each start. My only question is how
should I do it? I already log whether they want it or not, so I have
got that far.
Should I read the contents of my backup file? How could I find that
file, would it be safe to say: ~/Library/Preferences/Folder Name/
backup.xml
I hope you meant ~/Library/Application Support/...
If you started your project by using the "Core Data Application"
template, you should have an app delegate class that implements an -
applicationSupportFolder method. I'd use it like this: NSString
*originalPath = [[[NSApp delegate] applicationSupportFolder]
stringByAppendingPathComponent:@"data.xml"];
And read it, then write it into a new file? Or is there already a
backup feature for this sort of thing (for non Time Machine users)?
If you really just want to copy a file from one place to another, take
a look at the docs for NSFileManager, especially -
copyItemAtPath:toPath:error:
If you want to implement a more sophisticated backup functionality,
like incremental backups, it will be more difficult than that.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden