X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xaw%2Fxboard.c;h=b7cd5cc02253e6a5c52392f7edfcd6429587688b;hb=1e049e74232d3742d83054b6843d9d4a6446cb1a;hp=a557b417c6212c6d00ba898579d3fdc012a27f55;hpb=58829f360dca7d929444d8f3748bae8a37be7ad0;p=xboard.git diff --git a/xaw/xboard.c b/xaw/xboard.c index a557b41..b7cd5cc 100644 --- a/xaw/xboard.c +++ b/xaw/xboard.c @@ -204,7 +204,6 @@ extern char *getenv(); #include "draw.h" #define SLASH '/' -#define DATADIR "~~" #ifdef __EMX__ #ifndef HAVE_USLEEP @@ -257,6 +256,7 @@ void ManInner P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void DisplayMove P((int moveNumber)); void update_ics_width P(()); int CopyMemoProc P(()); +static int FindLogo P((char *place, char *name, char *buf)); /* * XBoard depends on Xt R4 or higher @@ -1293,8 +1293,10 @@ main (int argc, char **argv) if(appData.logoSize) { // locate and read user logo - char buf[MSG_SIZ]; - snprintf(buf, MSG_SIZ, "%s/%s.png", appData.logoDir, UserName()); + char buf[MSG_SIZ], name[MSG_SIZ]; + snprintf(name, MSG_SIZ, "/home/%s", UserName()); + if(!FindLogo(name, ".logo", buf)) + FindLogo(appData.logoDir, name + 6, buf); ASSIGN(userLogo, buf); } @@ -2493,6 +2495,19 @@ 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) { @@ -2502,8 +2517,11 @@ 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.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])