• 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
Preventing POSIX File to Alias Conversion from Inserting Leading Colon
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Preventing POSIX File to Alias Conversion from Inserting Leading Colon


  • Subject: Preventing POSIX File to Alias Conversion from Inserting Leading Colon
  • From: Grant Erickson <email@hidden>
  • Date: Sun, 16 Aug 2009 15:05:49 -0700
  • Organization: Nuovation System Designs, LLC
  • Thread-topic: Preventing POSIX File to Alias Conversion from Inserting Leading Colon

Is there a way to prevent POSIX file from inserting a leading colon to
relative paths, whether specified as literals or read as a value from
elsewhere?

I have the following script snippet:

    ...

    tell theDisk
        if 0 is equal to 1 then
            -- Fails due to ':' insertion
            set theBackground to POSIX file ".background/background.png"
        else
            -- Works
            set theBackground to file ".background:background.png"
        end if
    end tell

    set background picture of theOptions to theBackground

    ...

If I convert the POSIX path, I end up with ":.background:background.png"
which doesn't exist. Whereas, the string literal
".background:background.png" works correctly.

Ultimately, the POSIX literal will be replaced by a value accessed from a
property list record:

    set theBackground to (|Background| of (|Options| of theView)) as POSIX
file

I can, of course, coerce the converted path to text, change the text item
delimiters, chop the first item and coerce it back to a file; however, that
seems like an unseemly solution.

Regards,

Grant


 _______________________________________________
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: Preventing POSIX File to Alias Conversion from Inserting Leading Colon
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: Re: Accessing Child Elements of Property List Records or Lists
  • Next by Date: Re: Preventing POSIX File to Alias Conversion from Inserting Leading Colon
  • Previous by thread: Re: iCal events to a list
  • Next by thread: Re: Preventing POSIX File to Alias Conversion from Inserting Leading Colon
  • Index(es):
    • Date
    • Thread