Re: CoreData - cannot load .sqlstore if path contains Alias folder
Re: CoreData - cannot load .sqlstore if path contains Alias folder
- Subject: Re: CoreData - cannot load .sqlstore if path contains Alias folder
- From: Chris Hanson <email@hidden>
- Date: Wed, 5 Sep 2007 13:35:08 -0700
On Sep 5, 2007, at 12:20 PM, Simon Liu wrote:
Is there a quick way to resolve all the aliases in a given path,
checking all path components? Any 3rd party classes? I could write
some code using FSResolveAliasFile() but I imagine somebody has
already done this...
I don't know of any third-party categories on NSString or classes to
do it. You'll have to walk the path components using the methods in
<Foundation/NSPathUtilities.h> and resolve any Finder alias files you
come across yourself.
Again, though, generally speaking it should be *hard* to wind up with
a path in your application that happens to traverse a Finder alias
file. If you get a path from NSOpenPanel or NSSavePanel, that path
should already be resolved - no Finder alias file resolution necessary.
If you are storing a path in your user defaults it's possible that the
user could replace a component with a Finder alias file; in that case,
however, instead of a bare path you should really be storing an alias
record (using BDAlias, NDAlias, or the like) in your user defaults.
When you resolve that alias record to a path, the path will be fully-
resolved and not one that tries to traverse Finder alias files.
BTW: I tried BDAlias -initWithPath: and that fails - I guess it needs
a fully resolved posix path?
The BDAlias class is used to represent alias records, not Finder alias
files (which are a way of serializing alias records). Thus trying to
initialize a BDAlias instance from a path that traverses an alias will
have the same problem as trying to traverse that path in any other
fashion.
-- Chris
_______________________________________________
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