Implement -positionDir option GTK
[xboard.git] / menus.c
diff --git a/menus.c b/menus.c
index 9d2b286..653d978 100644 (file)
--- a/menus.c
+++ b/menus.c
@@ -173,10 +173,12 @@ ReloadPositionProc ()
 void
 LoadPositionProc()
 {
+    static char buf[MSG_SIZ];
     if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {
        Reset(FALSE, TRUE);
     }
-    FileNamePopUp(_("Load position file name?"), "", ".fen .epd .pos", LoadPosition, "rb");
+    snprintf(buf, MSG_SIZ, "%s/", appData.positionDir);
+    FileNamePopUp(_("Load position file name?"), buf, ".fen .epd .pos", LoadPosition, "rb");
 }
 
 void
@@ -1176,6 +1178,7 @@ InstallNewEngine (char *command, char *dir, char *variants, char *protocol)
        snprintf(buf + strlen(buf), MSG_SIZ - strlen(buf), " -fd %s", dir);
     if(!strcmp(protocol, "uci"))
        snprintf(buf + strlen(buf), MSG_SIZ - strlen(buf), " -fUCI");
+    if(strstr(firstChessProgramNames, buf)) return; // avoid duplicats
     // append line
     quote = malloc(strlen(firstChessProgramNames) + strlen(buf) + 2);
     sprintf(quote, "%s%s\n", firstChessProgramNames, buf);