automatically test ini file extension for files from commandline option @filename
[xboard.git] / winboard / winboard.c
index bdfc1f3..f4e6c0d 100644 (file)
@@ -495,6 +495,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
   if (!InitInstance(hInstance, nCmdShow, lpCmdLine)) {\r
     return (FALSE);\r
   }\r
+\r
 //  InitCommonControlsEx(&ex);\r
   InitCommonControls();\r
 \r
@@ -1428,8 +1429,14 @@ ParseSettingsFile(char *name, char fullname[MSG_SIZ])
 {\r
   char *dummy;\r
   FILE *f;\r
+  int ok; char buf[MSG_SIZ];\r
 \r
-  if (SearchPath(installDir, name, NULL, MSG_SIZ, fullname, &dummy)) {\r
+  ok = SearchPath(installDir, name, NULL, MSG_SIZ, fullname, &dummy);\r
+  if(!ok && strchr(name, '.') == NULL) { // [HGM] append default file-name extension '.ini' when needed\r
+    sprintf(buf, "%s.ini", name);\r
+    ok = SearchPath(installDir, buf, NULL, MSG_SIZ, fullname, &dummy);\r
+  }\r
+  if (ok) {\r
     f = fopen(fullname, "r");\r
     if (f != NULL) {\r
       ParseArgs(FileGet, f);\r