summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-12-01 23:18:49 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-12-01 23:18:49 (GMT)
commit9eaeb8308ff9d69376a16893e7dc39f294c44198 (patch)
tree24c98fbde098f2d1bc296137a0bc6efaa00c323f /win
parent5832d6e914aef53f269531d6ad9b8d2a14036b6c (diff)
downloadtcl-9eaeb8308ff9d69376a16893e7dc39f294c44198.zip
tcl-9eaeb8308ff9d69376a16893e7dc39f294c44198.tar.gz
tcl-9eaeb8308ff9d69376a16893e7dc39f294c44198.tar.bz2
* generic/tclUtil.c: Updated Tcl_GetNameOfExecutable() to
* generic/tclEncoding.c: make use of a ProcessGlobalValue for * generic/tclEvent.c: storing the executable name. Added internal routines Tcl(Get|Set)ObjNameOfExecutable() to access that storage in Tcl_Obj, rather than string format. * unix/tclUnixFile.c: Rewrote TclpFindExecutable() to use * win/tclWinFile.c: TclSetObjNameOfExecutable to store the executable name it computes. * generic/tclInt.h: Added internal stub entries for * generic/tclInt.decls: TclpFindExecutable and Tcl(Get|Set)ObjNameOfExecutable. * generic/tclIntDecls.h: make genstubs * generic/tclStubInit.c: * generic/tclCmdIL.c: Retrieve executable name in Tcl_Obj form * win/tclWinPipe.c: instead of string form. * unix/tclUnixTest.c: Update [testfindexecutable] command to use new internal interfaces.
Diffstat (limited to 'win')
-rw-r--r--win/tclWinFile.c29
-rw-r--r--win/tclWinPipe.c8
2 files changed, 7 insertions, 30 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 8c39505..4e73891 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinFile.c,v 1.71 2004/11/30 19:34:51 dgp Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.72 2004/12/01 23:18:55 dgp Exp $
*/
//#define _WIN32_WINNT 0x0500
@@ -674,19 +674,13 @@ NativeWriteReparse(LinkDirectory, buffer)
* TclpFindExecutable --
*
* This procedure computes the absolute path name of the current
- * application, given its argv[0] value.
+ * application.
*
* Results:
- * A clean UTF string that is the path to the executable. At this
- * point we may not know the system encoding, but we convert the
- * string value to UTF-8 using core Windows functions. The path name
- * contains ASCII string and '/' chars do not conflict with other UTF
- * chars.
+ * None.
*
* Side effects:
- * The variable tclNativeExecutableName gets filled in with the file
- * name for the application, if we figured it out. If we couldn't
- * figure it out, tclNativeExecutableName is set to NULL.
+ * The computed path is stored.
*
*---------------------------------------------------------------------------
*/
@@ -698,14 +692,6 @@ TclpFindExecutable(argv0)
{
WCHAR wName[MAX_PATH];
char name[MAX_PATH * TCL_UTF_MAX];
- Tcl_DString ds;
-
- if (argv0 == NULL) {
- return;
- }
- if (tclNativeExecutableName != NULL) {
- return;
- }
/*
* Under Windows we ignore argv0, and return the path for the file used to
@@ -721,12 +707,7 @@ TclpFindExecutable(argv0)
}
WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, sizeof(name), NULL, NULL);
TclWinNoBackslash(name);
-
- Tcl_UtfToExternalDString(NULL, name, -1, &ds);
- tclNativeExecutableName = ckalloc((unsigned) (Tcl_DStringLength(&ds) + 1));
- strcpy(tclNativeExecutableName, Tcl_DStringValue(&ds));
- Tcl_DStringFree(&ds);
- Tcl_GetNameOfExecutable();
+ TclSetObjNameOfExecutable(Tcl_NewStringObj(name, -1), NULL);
}
/*
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index 4b18c02..2601e4f 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.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: tclWinPipe.c,v 1.52 2004/11/30 19:34:52 dgp Exp $
+ * RCS: @(#) $Id: tclWinPipe.c,v 1.53 2004/12/01 23:18:55 dgp Exp $
*/
#include "tclWinInt.h"
@@ -1211,11 +1211,7 @@ TclpCreateProcess(
Tcl_DString pipeDll;
Tcl_DStringInit(&pipeDll);
Tcl_DStringAppend(&pipeDll, TCL_PIPE_DLL, -1);
-
- /* For safety, just in case the app didn't call it first */
- Tcl_FindExecutable(NULL);
-
- tclExePtr = Tcl_NewStringObj(Tcl_GetNameOfExecutable(), -1);
+ tclExePtr = TclGetObjNameOfExecutable();
start = Tcl_GetStringFromObj(tclExePtr, &i);
for (end = start + (i-1); end > start; end--) {
if (*end == '/') {