Re: resolving aliases
Re: resolving aliases
- Subject: Re: resolving aliases
- From: Yvon Thoraval <email@hidden>
- Date: Fri, 4 Aug 2006 14:43:00 +0200
Le 4 août 06 à 13:56, Bill Bumgarner a écrit :
The easiest way to solve this is to write a very simple Objective-C
class that makes the appropriate C calls to resolve the alias.
Then, load said class into your RubyCocoa app -- either by linking
it into the main project (if possible -- I haven't looked closely
at RubyCocoa's Cocoa project templates) or by creating a standard
Cocoa style NSBundle and dynamically loading it via NSBundle's API
from Ruby.
yes right i even found something here, allready done :
<http://bdistributed.com/Projects/BDAlias/>
they are following correctly what is given by Apple here : <http://
developer.apple.com/documentation/Cocoa/Conceptual/LowLevelFileMgmt/
Tasks/ResolvingAliases.html> (Resolving Aliases).
i did a little test on this BDAlias class, desapointing, here is my
ruby test :
------------------------------------------------------------------------
------------------------------------------------
OSX.ns_import('BDAlias')
f=OSX::BDAlias.alloc.initWithPath("/Users/yvon/work/RubyCocoa/
MacSOUPSwitcher/map/read-alias/search/for/the/original/file/read-
alias.pl")
p "f.class=#{f.class}"
# => "f.class=OSX::BDAlias"
p "f.fullPath=#{f.fullPath}"
# => "f.fullPath=/Users/yvon/work/RubyCocoa/MacSOUPSwitcher/map/read-
alias/search/for/the/original/file/read-alias.pl"
------------------------------------------------------------------------
------------------------------------------------
the BDAlias.rtf file saying :
- (NSString *)fullPath
Returns an autoreleased string containing the full path of the
object pointed to by an alias.
_____________________________________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^
BUT in my test fullPath returns the path of the alias itself ))) not
of the file/folder the alias point to...
howver, i get the path of the alias, i've read the ObjC code and it
looks correct, very similar to Apple's writing.
something i misunderstood ?
let me tell you what i've learned on how to resolve alias (from
Apple's page reading) ;
- 1 - convert URL to FSRef ;
- 2 - resolve alias in the FSRef "domain" ;
- 3 convert back FSRef to URL.
that's all.
that's exactly what is doing the class BDAlias.
best,
Yvon _______________________________________________
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