• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Resolving an alias
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resolving an alias


  • Subject: Re: Resolving an alias
  • From: Emmanuel LEVY <email@hidden>
  • Date: Fri, 30 Oct 2009 17:12:28 +0100

We think it's better to work with posix paths rather than the native mac types for files.

(For those interested, the strong reason is that alias fails at making the difference between two mounted volumes or two shared volumes with the same name).

If you work with posix paths, here's our set of core handlers for the question you ask:

on dereferencepath(f) -- resolving an alias
try
return POSIX path of (POSIX file f as alias)
end try
end dereferencepath
on validlink(x) -- is that a symbolic link?
dereferencepath(x) is not in {x, x & "/"}
end validlink
on validfolder(x) -- is that a folder?
try
return ((POSIX path of (POSIX file x as alias)) ends with "/")
end try
return false
end validfolder
on validalias(x) -- is that a valid reference to whatever but to something?
try
POSIX file x as alias
return true
end try
return false
end validalias


Emmanuel
Satimage-software, and Quomodo

On Oct 30, 2009, at 4:34 PM, Thomas Fischer wrote:

Sander,

[...]

If somebody drops anything on your AppleScript app, your on handler
receives a list of aliases and I was wondering how I could decide if
they were files, folders or anything else.

tell me info for someAlias end

No, this doesn't quite do what I need, unless I go into some additional analysis of the info record I get. I get a folder flag, but would need to check if the alias is e.g. for a file or an internet location. And it definitely doesn't give me a hold of the original file.


Deivy's method

tell application "Finder" to class of (get properties of l)

gets the correct class if this is all I need.

Thomas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden

_______________________________________________ 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
  • Follow-Ups:
    • Re: Resolving an alias
      • From: Roger Howard <email@hidden>
    • Re: Resolving an alias
      • From: Luther Fuller <email@hidden>
References: 
 >Resolving an alias (From: Thomas Fischer <email@hidden>)
 >Re: Resolving an alias (From: Sander Tekelenburg <email@hidden>)
 >Re: Resolving an alias (From: Thomas Fischer <email@hidden>)

  • Prev by Date: Re: Resolving an alias
  • Next by Date: Re: Resolving an alias
  • Previous by thread: Re: Resolving an alias
  • Next by thread: Re: Resolving an alias
  • Index(es):
    • Date
    • Thread