• 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: Integrating Unix scripting in Cocoa app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Integrating Unix scripting in Cocoa app


  • Subject: Re: Integrating Unix scripting in Cocoa app
  • From: Ron Fleckner <email@hidden>
  • Date: Wed, 8 Aug 2007 19:58:37 +1000


On 08/08/2007, at 6:28 AM, Craig Hunter wrote:


Message: 10
Date: Wed, 8 Aug 2007 00:02:29 +1000
From: Ron Fleckner <email@hidden>
Subject: Re: Integrating Unix scripting in Cocoa app
To: Sherm Pendley <email@hidden>
Cc: Cocoa Dev <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

OK, "launch path not accessible" in the run log. I take back
everything I said.  Obviously I need to rethink this.  I would like
the user to be able to include a script file without having to make
it executable.  Earlier, I had a look to see if there is a way to
determine whether is file is executable, but didn't find one.  I
suppose there must be a way but didn't see it in NSFileManager or
NSWorkspace.



Ron,

Take a look at the shell's "source" command, which will load and execute
commands from a text file with no other requirements:


    source file.txt

This might give you an additional option. Perhaps you can check to see if
the file is executable and/or if it includes the shebang. If not, then
conclude it's merely a text file containing shell commands and pass it along
to "source" to run.


But here's something interesting: according to a simple "hello world" script
I just tested, source will even handle text files that have execute
permission set and contain a shebang (ie, real scripts). If that turns out
to be true in general, then you can let the source command execute anything
designated as a script by the user. I'd recommend testing it out.


Craig

--
Dr. Craig Hunter
NASA Langley Research Center
Configuration Aerodynamics Branch
email@hidden
(757) 864-3020


Well that sounds pretty interesting. I don't have the energy to investigate it right now (too much to do!), but I certainly will look at "source" as a generic script runner. When you say "shell", which one do you mean?


Ron
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Integrating Unix scripting in Cocoa app
      • From: Craig Hunter <email@hidden>
    • Re: Integrating Unix scripting in Cocoa app
      • From: Andrew Farmer <email@hidden>
References: 
 >Re: Integrating Unix scripting in Cocoa app (From: Craig Hunter <email@hidden>)

  • Prev by Date: Re: Issue with running a process as root
  • Next by Date: Re: Problem with NSTreeController, CoreData and bindings
  • Previous by thread: Re: Integrating Unix scripting in Cocoa app
  • Next by thread: Re: Integrating Unix scripting in Cocoa app
  • Index(es):
    • Date
    • Thread