Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Quick Q: Sample code to resolve alias?

Quick Q: Sample code to resolve alias?
Thread Tools
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Sep 2, 2003, 08:31 AM
 
Hi all,

I have what must be a simple question for people who know their way around Carbon: How can I resolve an alias, given a POSIX path?

All I want is a simple command-line tool that I can feed the POSIX path to an alias file, and will spit out the POSIX path to its 'original item'.

Is this easily done?

TIA,
mithras
     
Banned
Join Date: Apr 2002
Location: -
Status: Offline
Reply With Quote
Sep 2, 2003, 10:11 AM
 
search google for 'BDAlias', it's a fun Cocoa wrapper..
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Sep 2, 2003, 11:07 AM
 
There's some sample code in the section that describes NSFileManager in the Cocoa documentation. The only thing I discovered about it is that whoever wrote it forgot to release one of the strings...
[Wevah setPostCount:[Wevah postCount] + 1];
     
Mithras  (op)
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Sep 2, 2003, 03:09 PM
 
Great, thanks very much. BDAlias made it a two-liner.
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Sep 2, 2003, 03:13 PM
 
Also, the extensions to NSFileManager in our open source OmniFoundation framework provide methods for both one-shot and recursive alias resolution. (The latter is what you generally want: given the path /foo/bar/baz/blegga, you want to be able to resolve it if any path element is an alias.) You can pretty easily pull this code out of the framework for use in your own projects.
Rick Roe
icons.cx | weblog
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:21 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2