Re: Alias Files
Re: Alias Files
- Subject: Re: Alias Files
- From: KOENIG Yvan <email@hidden>
- Date: Sun, 3 Aug 2008 11:03:27 +0200
Le 3 août 2008 à 07:51, Philip Aker a écrit :
On 2008-08-02, at 03:35:20 , KOENIG Yvan wrote:
Try this instead: <http://vcn.bc.ca/~philip/#GetAliasTarget>.
I downloade it.
I'm running 10.4.11
If the media is missing, I get an error exactly as I get one with
a Finder call ;-(
I see. It's not a problem on my setups when the alias was created
on either 10.4 or 10.5. In the process of checking out your report,
I think I found a solution -- well at least proof of concept.
I believe the problem is multifold because there are two forms of
storage for aliases and two sets of APIs for dealing with them. So
if you created those aliases long ago, they will be stored in the
old style and the old style functions to get the path are needed to
retrieve them. Furthermore there is a consideration between PPC and
Intel for resource fork byte ordering.
So I created version 1.0.1 of GetAliasTarget which uses those old
style functions. So if you can verify that you get the HFS path
using version 1.0.1, I think everyone should file a bug because
then there's some proof that it can be done.
Bingo.
With this script:
tell application "Finder"
set thePath to (the clipboard as «class furl») as text
set class_of_item to class of item thePath
if class_of_item is alias file then
try
set originalPath to original item of item thePath as text (* send
an error if the original file is not inline *)
on error
set originalPath to do shell script "/usr/local/bin/GetAliasTarget
" & quoted form of POSIX path of thePath
end try
else
set originalPath to thePath
end if
end tell
display dialog originalPath
and the new GetAliasTarget
I get the Posix path of an alias whose original file is on a missing
volume.
Here is the log.
tell application "Finder"
the clipboard as «class furl»
file "Macintosh
HD:Users:yvan_koenig:Desktop:pour_modifier_Numbers.zip"
get class of item "Macintosh
HD:Users:yvan_koenig:Desktop:pour_modifier_Numbers.zip"
alias file
get original item of item "Macintosh
HD:Users:yvan_koenig:Desktop:pour_modifier_Numbers.zip"
do shell script "/usr/local/bin/GetAliasTarget '/Users/yvan_koenig/
Desktop/pour_modifier_Numbers.zip'"
"/Volumes/Sans titre/pour_modifier_Numbers.zip"
end tell
tell current application
display dialog "/Volumes/Sans titre/pour_modifier_Numbers.zip"
{button returned:"OK"}
end tell
I am not sufficiently fluent with English to send a correct bug
report for such a thing :-(
Yvan KOENIG (from FRANCE dimanche 3 août 2008 11:03:17)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden