X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gtk%2Fxboard.c;h=8179fa15831b1674b42b7b333cc89368405cf188;hb=6b19d6b88b12d1e1493d778d140e99c4f751faff;hp=b1f7103b57798d72bcf0c57d053ce56973aacaf5;hpb=e199c3a38e21db763c429cc79e4a47f3dfdcc2a5;p=xboard.git diff --git a/gtk/xboard.c b/gtk/xboard.c index b1f7103..8179fa1 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -176,12 +176,15 @@ extern char *getenv(); // redefine some defaults # undef ICS_LOGON # undef DATADIR +# undef LOCALEDIR # undef SETTINGS_FILE # define ICS_LOGON "Library/Preferences/XboardICS.conf" # define DATADIR dataDir +# define LOCALEDIR localeDir # define SETTINGS_FILE masterSettings # define SYNC_MENUBAR gtkosx_application_sync_menubar(theApp) char dataDir[MSG_SIZ]; // for expanding ~~ + char localeDir[MSG_SIZ]; char masterSettings[MSG_SIZ]; #else # define SLASH '/' @@ -873,6 +876,10 @@ main (int argc, char **argv) #ifdef __APPLE__ { // prepare to catch OX OpenFile signal, which will tell us the clicked file char *path = gtkosx_application_get_bundle_path(); +#ifdef ENABLE_NLS + char *res_path = gtkosx_application_get_resource_path(); + snprintf(localeDir, MSG_SIZ, "%s/share/locale", res_path); // redefine locale dir for OSX bundle +#endif theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL); strncpy(dataDir, path, MSG_SIZ); snprintf(masterSettings, MSG_SIZ, "%s/Contents/Resources/etc/xboard.conf", path); @@ -2233,24 +2240,33 @@ FrameDelay (int time) #endif +static int +FindLogo (char *place, char *name, char *buf) +{ // check if file exists in given place + FILE *f; + if(!place) return 0; + snprintf(buf, MSG_SIZ, "%s/%s.png", place, name); + if(*place && strcmp(place, ".") && (f = fopen(buf, "r")) ) { + fclose(f); + return 1; + } + return 0; +} + static void LoadLogo (ChessProgramState *cps, int n, Boolean ics) { char buf[MSG_SIZ], *logoName = buf; - FILE *f; if(appData.logo[n][0]) { logoName = appData.logo[n]; } else if(appData.autoLogo) { if(ics) { // [HGM] logo: in ICS mode second can be used for ICS sprintf(buf, "%s/%s.png", appData.logoDir, appData.icsHost); - } else { // engine; look in engine-dir (if any) first - snprintf(buf, MSG_SIZ, "%s/logo.png", appData.directory[n]); - if(appData.directory[n] && appData.directory[n][0] - && strcmp(appData.directory[n], ".") && (f = fopen(buf, "r")) ) - fclose(f); - else // no engine dir or no logo.png in it: look in logo dir - if(appData.logoDir && appData.logoDir[0]) - sprintf(buf, "%s/%s.png", appData.logoDir, cps->tidy); + } else { // engine; cascade + if(!FindLogo(appData.logoDir, cps->tidy, buf) && // first try user log folder + !FindLogo(appData.directory[n], "logo", buf) && // then engine directory + !FindLogo("/usr/local/share/games/plugins/logos", cps->tidy, buf) ) // then system folders + FindLogo("/usr/share/games/plugins/logos", cps->tidy, buf); } } if(logoName[0])