Let WinBoard recognize ~ in settings file name as HOMEPATH
authorH.G. Muller <h.g.muller@hccnet.nl>
Fri, 26 Mar 2010 14:28:54 +0000 (15:28 +0100)
committerArun Persaud <arun@nubati.net>
Sat, 27 Mar 2010 18:36:52 +0000 (11:36 -0700)
Fetch the appropriate environment variable to build the mathname in
MySearchPath() whenever the file name starts with "~\".

winboard/winboard.c

index 195ecfc..509ba76 100644 (file)
@@ -1223,6 +1223,14 @@ int
 MySearchPath(char *installDir, char *name, char *fullname)\r
 {\r
   char *dummy;\r
+  if(name[0] == '~' && name[1] == '\\') { // [HGM] recognize ~ as HOMEPATH environment variable\r
+    installDir = getenv("HOMEPATH");\r
+    name += 2;\r
+    strcpy(fullname, installDir);\r
+    strcat(fullname, "\\");\r
+    strcat(fullname, name);\r
+    return strlen(fullname);\r
+  }\r
   return (int) SearchPath(installDir, name, NULL, MSG_SIZ, fullname, &dummy);\r
 }\r
 \r