Ah, OK. And that apparently generates an OpenFile signal to the XBoard you just started that way. (And in response to that it will start another by calling system("xboard PGNFILE"), which presumably behaves exactly as if you had typed that in a terminal, so that it again receives the OpenFile signal, etc.)JoshPettus wrote:No I drag the launcher script and the pgn file so essentially it comes down to
Xboard PGNFILE in the terminal. then I hit enter.
It is a bit weird that XBoard started from the command line would receive an OpenFile signal, and even weirder that it apparently receives the PGNFILE that was its argument with that signal. How could OSX know that PGNFILE was actually a file to be opened? What happens when you type "xboard -ncp" or "xboard -fcp crafty"? Would it then also receive OpenFile requests for the 'files' with name -ncp or -fcp? And what if you start it without arguments altogether? Would you still get an OpenFile signal, but with a NULL name as path?
If there always is an OpenFile event after starting XBoard, we should simply ignore the first such event. This can be done by adding two lines:
Code: Select all
StartNewXBoard()
{
char buf[MSG_SIZ];
static int first = TRUE; // ADD
if(first) { first = FALSE; return TRUE; } // ADD
snprintf(...
}