• 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
Q about coercion to POSIX file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Q about coercion to POSIX file


  • Subject: Q about coercion to POSIX file
  • From: Brennan <email@hidden>
  • Date: Thu, 30 Oct 2003 16:49:33 +0100

I'm having some confusion with the coercion 'as POSIX file'.

First problem, getting a 'special folder' as a posix path (using
'Applications' as an example):

set myPath to (path to "apps") as POSIX file
--> fails, 'Can't make <blah> into a POSIX file'.

set myPath to ((path to "apps") as string) as POSIX file

-->file ":Macintosh HD/Users/brennan/Applications/"

Why do I need to go to string first? Can't I coerce directly from an
alias?

Secondly, why does a colon get added to the beginning? If I want to feed
this path to 'do shell script' I would apparently have to strip the colon
away first. Am I missing something?

This is Applescript 1.9.1 with Script Editor 2.0 (v36) (a beta?)

BTW, I realise that I can also do

set myPath to POSIX path of (path to "apps")

and

set myPath to POSIX path of "Some:Arbitrary:PathString"
--> "/Some/Arbitrary/PathString"

Which is good, but it seems to me that 'POSIX path of' also converts
'backwards', sort of.

set myPath to (POSIX path of "test/hello")
--> "/test:hello"

What is the thinking behind this?

Brennan
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Changing case to lower case in QuarkXPress v5
  • Next by Date: Re: Keychain scripting appears to be dead
  • Previous by thread: Re: Panther: AppleScript 1.9.2 Release Notes
  • Next by thread: Re: Q about coercion to POSIX file
  • Index(es):
    • Date
    • Thread