diff options
-rw-r--r-- | unix/tclUnixInit.c | 50 | ||||
-rw-r--r-- | win/tclWinInit.c | 53 |
2 files changed, 94 insertions, 9 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index b561133..349b0ff 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixInit.c,v 1.13 1999/04/16 00:48:05 stanton Exp $ + * RCS: @(#) $Id: tclUnixInit.c,v 1.14 1999/04/21 22:00:29 stanton Exp $ */ #include "tclInt.h" @@ -253,9 +253,23 @@ CONST char *path; /* Path to the executable in native } /* - * Look for the library relative to the executable. Use both the - * installLib and developLib because we cannot determine if this - * is installed or not. + * Look for the library relative to the executable. This algorithm + * should be the same as the one in the tcl_findLibrary procedure. + * + * This code looks in the following directories: + * + * <bindir>/../<installLib> + * (e.g. /usr/local/bin/../lib/tcl8.1) + * <bindir>/../../<installLib> + * (e.g. /usr/local/TclPro/solaris-sparc/bin/../../lib/tcl8.1) + * <bindir>/../library + * (e.g. /usr/src/tcl8.1/unix/../library) + * <bindir>/../../library + * (e.g. /usr/src/tcl8.1/unix/solaris-sparc/../../library) + * <bindir>/../../<developLib> + * (e.g. /usr/src/tcl8.1/unix/../../tcl8.1/library) + * <bindir>/../../../<devlopLib> + * (e.g. /usr/src/tcl8.1/unix/solaris-sparc/../../../tcl8.1/library) */ if (path != NULL) { @@ -268,12 +282,40 @@ CONST char *path; /* Path to the executable in native Tcl_DStringFree(&ds); } if (pathc > 2) { + pathv[pathc - 3] = installLib; + path = Tcl_JoinPath(pathc - 2, pathv, &ds); + objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds)); + Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); + Tcl_DStringFree(&ds); + } + if (pathc > 1) { + pathv[pathc - 2] = "library"; + path = Tcl_JoinPath(pathc - 1, pathv, &ds); + objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds)); + Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); + Tcl_DStringFree(&ds); + } + if (pathc > 2) { + pathv[pathc - 3] = "library"; + path = Tcl_JoinPath(pathc - 2, pathv, &ds); + objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds)); + Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); + Tcl_DStringFree(&ds); + } + if (pathc > 1) { pathv[pathc - 3] = developLib; path = Tcl_JoinPath(pathc - 2, pathv, &ds); objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds)); Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); Tcl_DStringFree(&ds); } + if (pathc > 3) { + pathv[pathc - 4] = developLib; + path = Tcl_JoinPath(pathc - 3, pathv, &ds); + objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds)); + Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); + Tcl_DStringFree(&ds); + } ckfree((char *) pathv); } diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 7f03f2c..a200098 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinInit.c,v 1.14 1999/04/16 00:48:08 stanton Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.15 1999/04/21 22:00:29 stanton Exp $ */ #include "tclWinInt.h" @@ -217,12 +217,27 @@ TclpInitLibraryPath(path) AppendDllPath(pathPtr, TclWinGetTclInstance(), installLib); + /* - * Look for the library relative to the executable. Use both the - * installLib and developLib because we cannot determine if this - * is installed or not. + * Look for the library relative to the executable. This algorithm + * should be the same as the one in the tcl_findLibrary procedure. + * + * This code looks in the following directories: + * + * <bindir>/../<installLib> + * (e.g. /usr/local/bin/../lib/tcl8.1) + * <bindir>/../../<installLib> + * (e.g. /usr/local/TclPro/solaris-sparc/bin/../../lib/tcl8.1) + * <bindir>/../library + * (e.g. /usr/src/tcl8.1/unix/../library) + * <bindir>/../../library + * (e.g. /usr/src/tcl8.1/unix/solaris-sparc/../../library) + * <bindir>/../../<developLib> + * (e.g. /usr/src/tcl8.1/unix/../../tcl8.1/library) + * <bindir>/../../../<devlopLib> + * (e.g. /usr/src/tcl8.1/unix/solaris-sparc/../../../tcl8.1/library) */ - + if (path != NULL) { Tcl_SplitPath(path, &pathc, &pathv); if (pathc > 1) { @@ -233,12 +248,40 @@ TclpInitLibraryPath(path) Tcl_DStringFree(&ds); } if (pathc > 2) { + pathv[pathc - 3] = installLib; + path = Tcl_JoinPath(pathc - 2, pathv, &ds); + objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds)); + Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); + Tcl_DStringFree(&ds); + } + if (pathc > 1) { + pathv[pathc - 2] = "library"; + path = Tcl_JoinPath(pathc - 1, pathv, &ds); + objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds)); + Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); + Tcl_DStringFree(&ds); + } + if (pathc > 2) { + pathv[pathc - 3] = "library"; + path = Tcl_JoinPath(pathc - 2, pathv, &ds); + objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds)); + Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); + Tcl_DStringFree(&ds); + } + if (pathc > 1) { pathv[pathc - 3] = developLib; path = Tcl_JoinPath(pathc - 2, pathv, &ds); objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds)); Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); Tcl_DStringFree(&ds); } + if (pathc > 3) { + pathv[pathc - 4] = developLib; + path = Tcl_JoinPath(pathc - 3, pathv, &ds); + objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds)); + Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); + Tcl_DStringFree(&ds); + } ckfree((char *) pathv); } |