• 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: Why is the initial working directory of 'do script' root?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is the initial working directory of 'do script' root?


  • Subject: Re: Why is the initial working directory of 'do script' root?
  • From: "Anthony Adachi" <email@hidden>
  • Date: Tue, 12 May 2009 22:28:34 -0400

On Mon, 11 May 2009 21:51:26 -0700 Philip Aker wrote:

>What you can rely on in Mac OS X AppleScript is the 'path to ...' command
>for getting well known system locations (including the current user's
>desktop, home, and other user sub-directories) and also, for running
>AppleScripts (i.e. those not being edited by a script editor), the 'path
>to me' command to give you the location of the script/applet/droplet
>currently being run. If you need to run a shell script in a location
>relative to the currently running script it's:
>
>set p2m to quoted form of (POSIX path of (path to me))
>do shell script "cd " & p2m & "; code-here"

You must of been reading my mind because that was going to be my next
question: Reliable, recommended syntax to run shell script commands
relative to the currently running script.

On Tue, 12 May 2009 12:02:51 -0700 Chris Nebel wrote:

>For a normally-launched application, neither the parent nor its
>working directory is well-defined.  These days it's launchd(8) and /,
>but that's changed a few times in the past, may change again, and
>isn't under user control, hence the warning to not rely on it.

I appreciate that bit of clarity and insight.


Thanks again everyone for the help and the clarifications!

Take care,

-Anthony



 _______________________________________________
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: Why is the initial working directory of 'do script' root?
      • From: Philip Aker <email@hidden>
  • Prev by Date: Re: Script to conditionaly uncheck Hide and show Front Row
  • Next by Date: Re: Why is the initial working directory of 'do script' root?
  • Previous by thread: Re: Script to conditionaly uncheck Hide and show Front Row
  • Next by thread: Re: Why is the initial working directory of 'do script' root?
  • Index(es):
    • Date
    • Thread