From 85164e1c15746506744f2ff807d7f39228a8b2f4 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sat, 13 Sep 2014 09:12:54 +0200 Subject: [PATCH] Look for logo in engine dir first (GTK) When setting engine logos, we look for a file logo.png in the engine directory, before trying .png in the -logoDir. This is useful on OS X. Fix bug that checks for existence of -fd/sd rather than -logoDir, when using the latter (also in Xaw). --- gtk/xboard.c | 11 +++++++++-- xaw/xboard.c | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gtk/xboard.c b/gtk/xboard.c index d8fcbaa..95229f0 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -2228,13 +2228,20 @@ 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 if(appData.directory[n] && appData.directory[n][0]) { - sprintf(buf, "%s/%s.png", appData.logoDir, cps->tidy); + } else { // engine; look in engine-dir (if any) first + snprintf(buf, MDG_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); } } if(logoName[0]) diff --git a/xaw/xboard.c b/xaw/xboard.c index f1d9747..86d4283 100644 --- a/xaw/xboard.c +++ b/xaw/xboard.c @@ -2502,7 +2502,7 @@ LoadLogo (ChessProgramState *cps, int n, Boolean ics) } 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 if(appData.directory[n] && appData.directory[n][0]) { + } else if(appData.logoDir && appData.logoDir[0]) { sprintf(buf, "%s/%s.png", appData.logoDir, cps->tidy); } } -- 1.7.0.4