From 38ff5eb2dc0da29a8138e4bedc94580405d570b0 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Thu, 2 Nov 2017 12:25:10 +0100 Subject: [PATCH] Add option -defaultEngineInstallDir (XB) A new option is added to configure what appears in the Directory text entry of the Load Engine dialog when you pop that up. It is volatile, and intended for use in the masted config file, to set what is convenient for Linux or OS X. --- args.h | 8 +++++++- common.h | 1 + dialogs.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/args.h b/args.h index cdf51aa..db6ec8f 100644 --- a/args.h +++ b/args.h @@ -624,6 +624,7 @@ ArgDescriptor argDescriptors[] = { { "fixedSize", ArgBoolean, (void *) &appData.fixedSize, TRUE, (ArgIniType) FALSE }, { "showMoveTime", ArgBoolean, (void *) &appData.moveTime, TRUE, (ArgIniType) FALSE }, { "bmpSave", ArgInt, (void *) &appData.bmpSave, FALSE, 0 }, + { "defaultEngineInstallDir", ArgFilename, (void *) &appData.defEngDir, FALSE, (ArgIniType) "." }, // [HGM] tournament options { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" }, @@ -1439,7 +1440,12 @@ InitAppData(char *lpCmdLine) ParseArgs(StringGet, &lpCmdLine); /* if separate engine list is used, parse that too */ - if(*engineListFile) ParseSettingsFile(engineListFile, &engineListFile); + if(*engineListFile) { + char buf[MSG_SIZ]; + MySearchPath(installDir, engineListFile, buf); + if(*buf) { ASSIGN(engineListFile, buf); } + ParseSettingsFile(engineListFile, &engineListFile); + } if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions); if(appData.tourney && appData.tourneyOptions[0]) ParseArgsFromString(appData.tourneyOptions); diff --git a/common.h b/common.h index 6638b36..09ce693 100644 --- a/common.h +++ b/common.h @@ -804,6 +804,7 @@ typedef struct { int recentEngines; char *recentEngineList; + char *defEngDir; char *message; char *suppress; char *fen; diff --git a/dialogs.c b/dialogs.c index b6febb1..38b1d08 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1572,7 +1572,7 @@ LoadEngineProc (int engineNr, char *title) isUCI = isUSI = storeVariant = v1 = useNick = False; addToList = hasBook = True; // defaults secondEng = engineNr; if(engineLine) free(engineLine); engineLine = strdup(""); - if(engineDir) free(engineDir); engineDir = strdup("."); + if(engineDir) free(engineDir); engineDir = strdup(appData.defEngDir); if(nickName) free(nickName); nickName = strdup(""); if(params) free(params); params = strdup(""); ASSIGN(engineMnemonic[0], ""); -- 1.7.0.4