summaryrefslogtreecommitdiffstats
path: root/generic/tclEnv.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclEnv.c')
-rw-r--r--generic/tclEnv.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index bc4f675..96d050d 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -127,6 +127,17 @@ TclSetupEnv(
/*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
TclFindArrayPtrElements(varPtr, &namesHash);
+#if defined(_WIN32)
+ if (tenviron == NULL) {
+ /*
+ * When we are started from main(), the _wenviron array could
+ * be NULL and will be initialized by the first _wgetenv() call.
+ */
+
+ (void) _wgetenv(L"WINDIR");
+ }
+#endif
+
/*
* Go through the environment array and transfer its values into Tcl. At
* the same time, remove those elements we add/update from the hash table