[Pythonmac-SIG] Finding what a broken alias refers to.
has
hengist.podd at virgin.net
Wed Jun 22 01:39:32 CEST 2005
Hubert Holin wrote:
> It would seem that the best function to get that information is
>thru the FSFollowFinderAlias function of the Alias Manager, but
>unfortunately the only version which is wrapped is a member of the
>Alias class, which I have not found a way to use, as all I have is an
>instance of FSRef.
As Bob says, you want to create a new Alias out of the alias file's alis resource, e.g.:
from Carbon.File import FSRef, Alias
from Carbon.Res import *
f = FSRef("/Users/has/a 'broken' Finder alias file")
resfile = FSOpenResFile(f, 1)
data = Get1IndResource('alis', 1).data
CloseResFile(resfile)
alias = Alias(rawdata=data)
To get any useful data out of this 'broken' alias you'll have to get your hands dirty though.
> Likewise, the Alias Manager functions FSMatchAlias and
>FSMatchAliasNoUI seem not to be wrapped.
Ditto FSCopyAliasInfo. Unfortunately I don't think Python's Carbon wrappers have been updated much since their creation back in pre-OS X days. You could probably patch up a copy yourself without much trouble; it's a slightly hackish solution, but not that hard to do (I've done it myself and my C's rubbish).
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
More information about the Pythonmac-SIG
mailing list