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

Re: Q about coercion to POSIX file


  • Subject: Re: Q about coercion to POSIX file
  • From: Paul Skinner <email@hidden>
  • Date: Thu, 30 Oct 2003 13:39:17 -0500

Just use the two commands as they were intended.

--Alias or path to posix path...
set x to POSIX path of (path to "apps")
-->"/Users/paul/Applications/"

--Posix path to file refference...
POSIX file x
-->file "titan:Users:paul:Applications:"

POSIX path does not convert 'backwards' it just blows up in a way that looks like it sort of works. Don't try it at home.

PS

On Thursday, October 30, 2003, at 10:49 AM, Brennan wrote:

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.
_______________________________________________
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: Add indented bookmarks in acrobat 4
  • Next by Date: Re: Setting labels of Finder items in Panther? You can, but... (coda)
  • Previous by thread: Re: Q about coercion to POSIX file
  • Next by thread: AppleScript blocks
  • Index(es):
    • Date
    • Thread