OS X - how to write to a file associated as a Unix executable
Warren Samples
warren at warrensweb.us
Mon Feb 29 19:06:38 EST 2016
On 02/29/2016 03:13 PM, Glen Bojsza wrote:
> Hello,
>
> I am trying to write the from a text field to a file and then change the
> file so it is executable.
>
> put field "mytest" into URL "binfile:~/race"
> or
> put field "mytest" into URL"file:~/race"
>
> The file race is created in either case but are associated with textedit.
>
> I require it to be recognized as a Unix executable associated with the
> terminal application once I have done a chmod +rx on it
>
> If I just save a file from textmate and do a chmod +rx then it works.
>
> So it has to do with how I am saving it out of LC.
>
> Any suggestions?
>
> thanks,
>
> Glen
You could look into fileType in the dictionary. I can recall having to
explicitly set the file type for images saved from LiveCode or they
would open in an editor because LiveCode was saving them as text files.
You could also try using 'get shell()' and whatever command or method
you feel most appropriate given you content, to create the file and then
make it executable by
'get shell("chomd +x /your/new/file")'
This works here under Linux and <should> work under OS X because the
file itself is being created and saved by the system instead of by LiveCode.
Warren
More information about the use-livecode
mailing list