Add option -defaultEngineInstallDir (XB)
authorH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 2 Nov 2017 11:25:10 +0000 (12:25 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 2 Nov 2017 11:28:45 +0000 (12:28 +0100)
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
common.h
dialogs.c

diff --git a/args.h b/args.h
index cdf51aa..db6ec8f 100644 (file)
--- 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);
index 6638b36..09ce693 100644 (file)
--- a/common.h
+++ b/common.h
@@ -804,6 +804,7 @@ typedef struct {
 
     int recentEngines;
     char *recentEngineList;
+    char *defEngDir;
     char *message;
     char *suppress;
     char *fen;
index b6febb1..38b1d08 100644 (file)
--- 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], "");