From: H.G. Muller Date: Fri, 26 Mar 2010 14:28:54 +0000 (+0100) Subject: Let WinBoard recognize ~ in settings file name as HOMEPATH X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=21b3e61d8cd19bc5c916def127f055da7faf6cc2;p=xboard.git Let WinBoard recognize ~ in settings file name as HOMEPATH Fetch the appropriate environment variable to build the mathname in MySearchPath() whenever the file name starts with "~\". --- diff --git a/winboard/winboard.c b/winboard/winboard.c index 195ecfc..509ba76 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -1223,6 +1223,14 @@ int MySearchPath(char *installDir, char *name, char *fullname) { char *dummy; + if(name[0] == '~' && name[1] == '\\') { // [HGM] recognize ~ as HOMEPATH environment variable + installDir = getenv("HOMEPATH"); + name += 2; + strcpy(fullname, installDir); + strcat(fullname, "\\"); + strcat(fullname, name); + return strlen(fullname); + } return (int) SearchPath(installDir, name, NULL, MSG_SIZ, fullname, &dummy); }