[OSX] Replacing the executable

BlitzMax Forums/BlitzMax Beginners Area/[OSX] Replacing the executable

explosive(Posted 2008) [#1]
Hello everybody,

I am about to write an updater for a programme of mine. The updater downloads an update-file from my server that has packed all files I want to replace and executes a simple script.
Now all works file apart from the executable (programme.app/Contents/MacOS/programme), that MacOS doesn't accept as a binary file: it says its plain text.
What can I do in this case? How can I set the type of that file so that it becomes a normal executable?

Many thanks in advance
Simon


ImaginaryHuman(Posted 2008) [#2]
Hmm, might be something to do with the way in which it was downloaded, you need to download a binary stream rather than text?


explosive(Posted 2008) [#3]
I don't think so actually. The file that is downloaded includes all files and the updater itself extract the data and saves them in a file. I guess I have to change the filetype after I finished saving all data in that file.


Brucey(Posted 2008) [#4]
chmod +x the_file

;-)


explosive(Posted 2008) [#5]
Hi Brucey,

I just found out myself. Many thanks indeed anyway.

I found a solution in the net that used SetFile but it doesn't seem to work.

Greetings
Simon


Brucey(Posted 2008) [#6]
BRL.FileSystem has the SetFileMode() method...

so perhaps something like

SetFileMode("the_file", 1877)

where 1877 = 0x755 = rwxr-xr-x (owner rwx, group rx, other rx)


explosive(Posted 2008) [#7]
Hmm... I now use the standart UNIX-command system_("chmod +x filename"). Works perfectly.