OS X - how to write to a file associated as a Unix executable

Warren Samples warren at warrensweb.us
Mon Feb 29 21:36:53 EST 2016


On 02/29/2016 07:06 PM, Glen Bojsza wrote:
> What I am trying to do is within a LC application
>
> 1. put field "mytest" into URL "binfile:~/race"
>
> This creates a file called race in the ~/ directory.
>
> The problem is that when you do a chmod +rw race the file is still
> recognized as textedit file and NOT a UNIX executable.
>
> When you look at a file created with LC and chmod  verses a file created
> with textmate and chmod you can see the differences in the finder or get
> info on both files and see the difference.


I understand the problem. What I am asking you is if creating a file 
using the shell function in LC instead of saving it directly from LC 
works. I can't tell from your response if you have tried it.
The first step would be to get the path of a file you know does what you 
want it to do. Then open a terminal and type:

cat /file-that-works > /file-that-works-new

then:

chmod +rx /file-that-works-new

Does this file do what you hope? If it does then the next step is to do 
the same thing using LiveCode's shell function. This should give the 
same result as using a terminal.

get shell("cat /file-that-works > /file-that-works3")
get shell("chmod +rx /file-that-works3")

We are attempting to bypass LiveCode's unfortunate desire to save 
everything as a text file and create a hard association with TextEdit in 
OS X.

I'm a little curious also about how you are telling TextMate to create 
and/or save the file. Are you explicitly telling it to create a shell 
script?


Warren




More information about the use-livecode mailing list