On Tue, 21 Jun 2005 11:21:17 -0400, Hubert Holin wrote
(in article <[EMAIL PROTECTED]>):

> Somewhere in the E.U., le 21/06/2005
> 
> Bonjour
> 
>      For my first Python steps on the Mac, I am trying to find  
> information on all broken aliases in a folder hierarchy (i.e. aliases  
> which were created thru the Finder and which no longer reference an  
> existing file or folder). While I am able to find the aliases which  
> are broken, I would like to go a step further, and indicate *what*  
> the alias thinks it is referencing (the "original" item in the Finder  
> info), and I am encountering some problem.
> 
>      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.
> 
>      Likewise, the Alias Manager functions FSMatchAlias and  
> FSMatchAliasNoUI seem not to be wrapped.
> 
>      What can I do, short of writing a C++ extension?
> 
> Merci
> 
> Hubert Holin
> 
> 
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> 

Here is a snippet from one of my utilities that might help.

 # deal with directory item relative to type
          if os.path.islink(dlfpath):
            
            # directory item a symbolic link, generate row of cells
            csvline = _cellpos(dlfpath, alvl, blvl, clvl)
            # identify as link with path
            lptr = '#Sym Link > ' + os.readlink(dlfpath)
            csvline = csvline + '"' + lptr + '"'
            
          elif FSResolveAliasFile(dlfpath, 1)[2]:
            
            # directory item an Aqua alias, generate row of cells
            csvline = _cellpos(dlfpath, alvl, blvl, clvl)
            # identify as alias with target 
            lptr = '#Alias > ' + FSResolveAliasFile(dlfpath, 
1)[0].as_pathname()
            csvline = csvline + '"' + lptr + '"'


Lee C


_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to