From 677d32ecebe49075a6889451de4e24c4c5947e44 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sat, 12 Mar 2016 16:41:38 +0100 Subject: [PATCH] Make location of man file dynamic for OSX MANDIR is redefined in the case of an OSX App to be a variable, in a similar way as DATADIR, so it can be determined at startup, and the App can be 'portable'. The way to concatenate it with the rest of the file name hd to be made variable-proof. --- dialogs.c | 9 +++++---- gtk/xboard.c | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dialogs.c b/dialogs.c index 084d9f4..2be171f 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2491,12 +2491,13 @@ GetHelpText (FILE *f, char *name) void DisplayHelp (char *name) { - char buf[MSG_SIZ], *manFile = MANDIR "/man6/xboard.6"; + char buf[MSG_SIZ]; FILE *f; - if(currentCps) snprintf(manFile = buf, MSG_SIZ, "/usr/share/man/man6/%s.6", currentCps->program); - f = fopen(manFile, "r"); + if(currentCps) snprintf(buf, MSG_SIZ, "/usr/local/share/man/man6/%s.6", currentCps->program); + else snprintf(buf, MSG_SIZ, "%s/man6/xboard.6", MANDIR); + f = fopen(buf, "r"); if(!f && currentCps) { // engine manual could be in two places - snprintf(buf, MSG_SIZ, "/usr/man/man6/%s.6", currentCps->program); + snprintf(buf, MSG_SIZ, "/usr/share/man/man6/%s.6", currentCps->program); f= fopen(buf, "r"); } if(f) { diff --git a/gtk/xboard.c b/gtk/xboard.c index c62f2c3..62de768 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -176,14 +176,17 @@ extern char *getenv(); // redefine some defaults # undef ICS_LOGON # undef DATADIR +# undef MANDIR # undef LOCALEDIR # undef SETTINGS_FILE # define ICS_LOGON "Library/Preferences/XboardICS.conf" # define DATADIR dataDir +# define MANDIR manDir # define LOCALEDIR localeDir # define SETTINGS_FILE masterSettings # define SYNC_MENUBAR gtkosx_application_sync_menubar(theApp) char dataDir[MSG_SIZ]; // for expanding ~~ + char manDir[MSG_SIZ]; char localeDir[MSG_SIZ]; char masterSettings[MSG_SIZ]; #else @@ -892,6 +895,7 @@ main (int argc, char **argv) theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL); snprintf(masterSettings, MSG_SIZ, "%s/Contents/Resources/etc/xboard.conf", path); snprintf(dataDir, MSG_SIZ, "%s/Contents/Resources/share/xboard", path); + snprintf(manDir, MSG_SIZ, "%s/Contents/Resources/share/man", path); snprintf(svgDir, MSG_SIZ, "%s/themes/default", dataDir); g_signal_connect(theApp, "NSApplicationOpenFile", G_CALLBACK(StartNewXBoard), NULL); g_signal_connect(theApp, "NSApplicationWillTerminate", G_CALLBACK(ExitEvent), NULL); -- 1.7.0.4