BBC BASIC
Development >> Mac OS-X >> Running program on MacOS
http://bbcbasic.conforums.com/index.cgi?board=macosx&action=display&num=1487681962

Running program on MacOS
Post by mavison on Feb 21st, 2017, 11:59am

In the Announements thread on Feb 6th, 2017, 1:53pm, Richard Russell wrote:
On most platforms you can simply specify the name of a BASIC program (as a tokenized .bbc file) on the command line. For example on both Windows and Linux you can do:
Code:
bbcsdl path/to/program.bbc 
and it will run that program. Indeed if you omit the command-line argument BBCSDL will search for the file bbcsdl.bbc in the current directory and run it if found. That's the mechanism by which the 'choose IDE' launcher is executed.


I found, after lots of trials and searching, that the following code in a MacOS command file will start a BBC program...

Code:
PARENT_DIR=$(dirname "$0")
open -a /Applications/BBCBasic.app --args "$PARENT_DIR/CVSapp/CVS.bbc" 

... which is called CVS.bbc in the directory CVSapp which is in the same directory as the command file. The command file must have a suffixed filetype of .command and must have had a 'chmod u+x <file>.command' done to it so it has execute authority.

Note this is not necessarily the best way - can anyone improve on it ?

One disadvantage is that it also opens a 'command window' using Terminal, but this can be closed when the program starts. I have not found a way of avoiding this, either in MacOS or using a .cmd file in Windows to achieve the same.
Re: Running program on MacOS
Post by Richard Russell on Feb 21st, 2017, 2:13pm

on Feb 21st, 2017, 11:59am, mavison wrote:
I found, after lots of trials and searching, that the following code in a MacOS command file will start a BBC program...

That's useful to know, well discovered! I wonder what the usage scenario is however, and how it compares with the alternative of creating a new self-contained application that runs your own program rather than the 'Choose IDE' tool.

Conceptually the latter is easy to achieve (in the simplest case replacing 'bbcsdl.bbc' with your program) although it will result in an app that doesn't have a valid Digital Signature, which could well cause issues with deployment.

Richard.
Re: Running program on MacOS
Post by mavison on Feb 21st, 2017, 2:32pm

I wanted to avoid any signature issues.