• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSURL from a sidebar plist entry (object for key "Alias")? [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURL from a sidebar plist entry (object for key "Alias")? [SOLVED]


  • Subject: Re: NSURL from a sidebar plist entry (object for key "Alias")? [SOLVED]
  • From: b UND d <email@hidden>
  • Date: Fri, 31 Mar 2006 11:41:32 +0200

Many thanks to Daniel Waylonis for solving my problem - he wrote:

Hi Dominik,

I think that the "Alias" is actually the NSData representation of a AliasHandle. You can probably create a new AliasHandle, copy the data over it, and then call FSResolveAlias() to get a FSRef out of it. Once you've got that, you can use CFURLCreateFromFSRef().

Dan


That's absolutely correct.  I tried this - it works :-)

...
FSRef theRef;
Boolean wasChanged;

NSData * theAliasData = [[ListItems objectAtIndex:j] objectForKey:@"Alias"];
AliasHandle aliasHandle = (AliasHandle)NewHandle( [theAliasData length] );
[theAliasData getBytes: *aliasHandle];
FSResolveAlias(NULL, aliasHandle, &theRef, &wasChanged);
CFURLRef theURL = CFURLCreateFromFSRef(NULL,&theRef);


NSLog(@"%@",[(NSURL *)theURL absoluteString]);
CFRelease(theURL);
...


Am 25.03.2006 um 17:04 schrieb b UND d:

Hi all,

hope you can help me? Probably I have missed sth simple ... how can I get a valid NSURL from such an object:

Alias = <00000000 013c0002 00010141 00000000 00000000 00000000 00000000 00000000 00000000 0000bcb5 8c15482b 00000002 e2c40946 61766f72 69746573 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000002 ed80b958 5acb005d a9eb005d 494bffff ffff0000 09200000 00000000 00000000 00000000 00074c69 62726172 79000010 00080000 bcb56ff5 00000011 00080000 b9583eab 00000001 000c0002 e2c40002 ddcf0002 d9b20002 001e413a 55736572 733a7062 67343a4c 69627261 72793a46 61766f72 69746573 000e0014 00090046 00610076 006f0072 00690074 00650073 000f0004 00010041 0012001c 55736572 732f7062 67342f4c 69627261 72792f46 61766f72 69746573 00130001 2f000015 0002000b ffff0000 >

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSURL from a sidebar plist entry (object for key "Alias")? (From: b UND d <email@hidden>)

  • Prev by Date: Re: $HOME not set?
  • Next by Date: keydown events + full-screen nswindow subclass
  • Previous by thread: NSURL from a sidebar plist entry (object for key "Alias")?
  • Next by thread: Separate string/file into "words"
  • Index(es):
    • Date
    • Thread