OSX Xboard 4.7.2 .app

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

I realized I can probably get what I want by running the 'sed' command in the GTK launcher script prior to executing xboard

I want it to search ~/Library/Preferences/Xboard.conf for any instance of "/dir/Xboard.app/ and replace it with "~~/

I gave it a try with:

Code: Select all

sed 's&#58;.*/XBoard.app&#58;"~~/&#58;g' <~/Library/Preferences/Xboard.conf >~/Library/Preferences/Xboard.conf
But no luck. have you used this command before?
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

Got it!

I just put this in right before the exec xboard command

Code: Select all

sed -e 's&#58; .*/XBoard.app/&#58; "~~/&#58;g' ~/Library/Preferences/Xboard.conf > ~/Library/Preferences/Xboard.conf.tmp && mv ~/Library/Preferences/Xboard.conf.tmp ~/Library/Preferences/Xboard.conf
This works pretty darn well, unless you have another solution.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: OSX Xboard 4.7.2 .app

Post by hgm »

A similar effect could be achieved by adding some code in the SaveSettings() routine in args.h, changing the ArgFilename case:

Code: Select all

    case ArgFilename&#58;
      if&#40;*&#40;char**&#41;ad->argLoc == NULL&#41; break; // just in case
      &#123; char buf&#91;MSG_SIZ&#93;;
#ifdef __APPLE__
        if&#40;strstr&#40;buf, DATADIR&#41; == buf&#41;
          snprintf&#40;buf, MSG_SIZ, "~~%s", *&#40;char**&#41;ad->argLoc + strlen&#40;DATADIR&#41;);
        else
#endif
          snprintf&#40;buf, MSG_SIZ, "%s", *&#40;char**&#41;ad->argLoc&#41;;
        if &#40;strchr&#40;buf, '\"')) &#123;
          fprintf&#40;f, OPTCHAR "%s" SEPCHAR "'%s'\n", ad->argName, buf&#41;;
        &#125; else &#123;
          fprintf&#40;f, OPTCHAR "%s" SEPCHAR "\"%s\"\n", ad->argName, buf&#41;;
        &#125;
      &#125;
      break;
    case ArgBoardSize&#58;
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

Neat! Oh well at least i got to learn about a rather powerful UNIX command I've never used before. :)

Weird... It's only working with a few of the options. here is the output in my user.conf

Code: Select all

-pieceImageDirectory "/Applications/Xboard/XBoard.app/Contents/Resources/share/xboard/textures/default"
-soundDirectory "~~/Contents/Resources/share/xboard/sounds"
-liteBackTextureFile "/Applications/Xboard/XBoard.app/Contents/Resources/share/xboard/textures/textures/wood_l.png"
-darkBackTextureFile "~~/Contents/Resources/share/xboard/textures/textures/wood_d.png"
-polyglotDir "/Applications/Xboard/XBoard.app/Contents/Resources/bin"
-logoDir "/Applications/Xboard/XBoard.app/../logos"
Really weird considering the input on my master conf for dark and lite board textures is near the same..

master.conf:

Code: Select all

-pieceImageDirectory "~~/Contents/Resources/share/xboard/textures/default"
-liteBackTextureFile  "~~/Contents/Resources/share/xboard/textures/textures/wood_l.png"
-darkBackTextureFile  "~~/Contents/Resources/share/xboard/textures/textures/wood_d.png"
-soundDirectory "~~/Contents/Resources/share/xboard/sounds"
-polyglotDir "~~/Contents/Resources/bin"
-logoDir "~~/../logos"
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: OSX Xboard 4.7.2 .app

Post by hgm »

Oh, sorry, I messed up in trying to simplify something I first had. Of course it is essential I first copy the unmodified string to buf before testing with strstr whether buf contains the substring DATADIR:

Code: Select all

    case ArgFilename&#58;
      if&#40;*&#40;char**&#41;ad->argLoc == NULL&#41; break; // just in case
      &#123; char buf&#91;MSG_SIZ&#93;;
        snprintf&#40;buf, MSG_SIZ, "%s", *&#40;char**&#41;ad->argLoc&#41;;
#ifdef __APPLE__
        if&#40;strstr&#40;buf, DATADIR&#41; == buf&#41;
          snprintf&#40;buf, MSG_SIZ, "~~%s", *&#40;char**&#41;ad->argLoc + strlen&#40;DATADIR&#41;);
#endif
        if &#40;strchr&#40;buf, '\"')) &#123;
          fprintf&#40;f, OPTCHAR "%s" SEPCHAR "'%s'\n", ad->argName, buf&#41;;
        &#125; else &#123;
          fprintf&#40;f, OPTCHAR "%s" SEPCHAR "\"%s\"\n", ad->argName, buf&#41;;
        &#125;
      &#125;
      break;
    case ArgBoardSize&#58;
I guess before it was only doing the replacement if the previous option (still left in buf) started with DATADIR.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

Great that worked!

here is a patch file off of the current master on savanah git

although the configure.ac bit doesn't actually work in that it doesn't carry -lgtkmacintegration and -headerpad_max_install_names (had to put it back in with the new code) into the LDFLAGS of the make file. Arun might want to look into it when he gets a chance.

https://www.dropbox.com/s/b51miziorhb41 ... rmac.patch
------
So that's all the major stuff. I'm feeling ready to put out the next mac .app. Where you guys going to release a 4.7.4 soon or should I just put it out as 4.7.4Beta or something like that?[/code]
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: OSX Xboard 4.7.2 .app

Post by hgm »

Just call it 4.7.3a, like what is now in the WinBoard binary package. There are no plans for a quick 4.7.4.

In fact we might go directly to 4.8.0; the latest development release contained significantly more stuff that is of interest to orthodox Chess players as the one on January 6 that was broken. Perhaps I still should have a go at making the ICS Input Box to a full ICS Interaction window WinBoard style, complete with context menu, and then release. And perhaps add 'Reveal (Chinese) Chess' as an official variant (if I succeed in making an engine for it).
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

Oh i didn't realize there was a 4.7.3a, Will do! :)

All that sounds really great! The reveal Chinese chess sounds like a lot of fun, Makes me think of the board game Stratego which also has ancient Chinese origins. I guess it makes sense.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: OSX Xboard 4.7.2 .app

Post by hgm »

JoshPettus wrote:Oh i didn't realize there was a 4.7.3a
Well, officially there isn't. But the official releases only influence which versions exactly are packaged as XBoard by the various Linux distro maintainers. For WinBoard almost no one compiles from source, and distribution is almost exclusively through the binary package that I host. So if I have a WinBoard-only fix, I just incorporate it in that package. It seems to me that for the OS X App the situation would be pretty much the same.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

In winboard there is a menu to edit the Engine section of the xboard.ini file directly. It would be very useful if we could do something similar for xboard only for the user conf instead. Its incredibly easy to make a mistake loading engines, and then have to go digging for the xboard.conf file to fix it. Particularly as apple wants me to put it in a partially inaccessible place. :\

Also an option to turn on/off auto logos would be nice in the general options. If at all possible. I realize its tricky as it's not a boolean function.