Oh sh*t! There is a conflict here between WinBoard option format (/variant=shogi) and the pathname starting with '/' as well. As the XBoard option parser always understands both formats, it thinks that the path name is an option...
I guess the only solution is to not have XBoard recognizing the WinBoard format. As far as I can see this should not cause any problems: settings are always saved in their own format, and for tourney files always in XBoard format (-variant shogi). It would make interchange of settings files between WinBoard and XBoard impossible, though.
(OPTCHAR is defined as '-' or as '/', depending on whether you are compiling XBoard or WinBoard.)
Perhaps in the future I will think of something smarter (like only not recognizing the WB format if it is really parsing a command line, rather than a file, so that you can still exchange files).
acutally leaving it as 'xboard' seems to work fine too as it somehow gets the path of the bundle it's trying to open and a bundle's executable is always in the Bundle.app/contents/MacOS folder
hgm wrote:Oh sh*t! There is a conflict here between WinBoard option format (/variant=shogi) and the pathname starting with '/' as well. As the XBoard option parser always understands both formats, it thinks that the path name is an option...
Lol silly Unix and it's reversed slashes to indicate directories. Why cant we all use back slashes. It's utter madness I tell you!
Well I got good news and I got bad news
The good news is it now works. It opens a pgn file with the OS open with in a new instance.
The bad news is it works a little too well...infinite instances...
All I can say is 10.9 has impressive memory handling as it didn't crash my computer. I just had to log out and log back in.
Apparently It doesn't matter if xboard is open before hand. As soon as I click on the pgn file and the OS sends xboard the open file command, it floods.
I tried commenting out the system(buf); line but that broke the command so it doesn't load the file.
[edit]
To be honest I find this encouraging, it tells me that all this trouble messing the macintegration library actually does something, and not be pointless when you fixed / bug.
What happens when you start XBoard from the command line, without clicking a file? Does it then also get the openFile signal from OS X? (Because that is what the system(buf) essentially does.) If it does, I cannot imagine what filename it would pass. Perhaps we should print that in the debug printf in StartNewXBoard():
Joshuas-MacBook-Pro:~ herecomethej$ /Users/herecomethej/Desktop/Xboard.app/Contents/MacOS/Xboard /Applications/Xboard/Josh-Crafty-23.5.pgn
Xboard
/Users/herecomethej/Desktop/Xboard.app/Contents/MacOS
Open new XBoard
New XBoard, path = '/Applications/Xboard/Josh-Crafty-23.5.pgn'
Dec 19 12:01:01 Joshuas-MacBook-Pro.local Xboard-bin[16264] <Error>: The function `CGContextErase' is obsolete and will be removed in an upcoming update. Unfortunately, this application, or a library it uses, is using this obsolete function, and is thereby contributing to an overall degradation of system performance.
Ignore the error, it always says that, unless it is an xboard problem. But I have never seen it in linux so it must be some library
Anyway I didn't uncomment the system(buf); though as the end result would make it hard to see what was going on, but in this instance the pgn file did load correctly. This would not be using the finder "open with" but I see the debug stuff anyway.
It occurred to me that's exactly what we wanted to see.
I uncommented the system(buff), opened up a terminal, dragged the xboard launcher and png file into it, and hit enter.
Sure enough, it opened again and again...
So it's not the Finder 'open with' signal that's at fault, as i didn't open the pgn file that way. It has something to do with how it's creating new instances for the opening of a pgn file. Though the load game menu works perfectly into the currently open instance. I'm not sure how that relates.
One thing I still do not quite understand. To start XBoard you drew the launcher script to the terminal, rather than typing a command to start XBoard? Then, you have an XBoard running (but not having loaded any file yet), and you drag a PGN file to the terminal?