From 21b3e61d8cd19bc5c916def127f055da7faf6cc2 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 26 Mar 2010 15:28:54 +0100 Subject: [PATCH] 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 "~\". --- winboard/winboard.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) 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); } -- 1.7.0.4