diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | win/tclWinInit.c | 27 |
2 files changed, 32 insertions, 4 deletions
@@ -1,3 +1,12 @@ +2004-02-19 Mo DeJong <mdejong@users.sourceforge.net> + + * win/tclWinInit.c (AppendEnvironment): + Use the tail component of the passed in + lib path instead of just blindly using + lib+4. That worked when lib was "lib/..." + but fails for other values. Thanks go to + Patrick Samson for pointing this out. + 2004-02-17 Jeff Hobbs <jeffh@ActiveState.com> *** 8.4.6 TAGGED FOR RELEASE *** diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 2a87937..96d6980 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -7,7 +7,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclWinInit.c,v 1.40.2.2 2003/11/10 20:32:34 dgp Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.40.2.3 2004/02/20 05:27:17 mdejong Exp $ */ #include "tclWinInt.h" @@ -362,6 +362,25 @@ AppendEnvironment( Tcl_Obj *objPtr; Tcl_DString ds; CONST char **pathv; + char *shortlib; + + /* + * The shortlib value needs to be the tail component of the + * lib path. For example, "lib/tcl8.4" -> "tcl8.4" while + * "usr/share/tcl8.5" -> "tcl8.5". + */ + for (shortlib = (char *) (lib + strlen(lib) - 1); shortlib > lib ; shortlib--) { + if (*shortlib == '/') { + if (shortlib == (lib + strlen(lib) - 1)) { + Tcl_Panic("last character in lib cannot be '/'"); + } + shortlib++; + break; + } + } + if (shortlib == lib) { + Tcl_Panic("no '/' character found in lib"); + } /* * The "L" preceeding the TCL_LIBRARY string is used to tell VC++ @@ -384,10 +403,10 @@ AppendEnvironment( /* * The lstrcmpi() will work even if pathv[pathc - 1] is random - * UTF-8 chars because I know lib is ascii. + * UTF-8 chars because I know shortlib is ascii. */ - if ((pathc > 0) && (lstrcmpiA(lib + 4, pathv[pathc - 1]) != 0)) { + if ((pathc > 0) && (lstrcmpiA(shortlib, pathv[pathc - 1]) != 0)) { CONST char *str; /* * TCL_LIBRARY is set but refers to a different tcl @@ -397,7 +416,7 @@ AppendEnvironment( * version string. */ - pathv[pathc - 1] = (lib + 4); + pathv[pathc - 1] = shortlib; Tcl_DStringInit(&ds); str = Tcl_JoinPath(pathc, pathv, &ds); objPtr = Tcl_NewStringObj(str, Tcl_DStringLength(&ds)); |