blob: 3c09b265bb36040120d0743cb1699ba754ec28be [file] [log] [blame]
diff -Naur Python-3.8.0-orig/Modules/getpath.c Python-3.8.0/Modules/getpath.c
--- Python-3.8.0-orig/Modules/getpath.c 2019-10-22 10:02:47.765731400 +0300
+++ Python-3.8.0/Modules/getpath.c 2019-10-22 10:02:49.637734700 +0300
@@ -1393,6 +1393,36 @@
return status;
}
+#ifdef MS_WINDOWS
+ if (calculate->path_env) {
+ wchar_t *module_path, *norm_path;
+ // Add path of executable/dll to system path. This
+ // is so that the correct tcl??.dll and tk??.dll get used.
+ module_path = calculate->dll_path[0] ? calculate->dll_path : pathconfig->program_full_path;
+ norm_path = (wchar_t *)alloca(sizeof(wchar_t) * (wcslen(module_path) + 1));
+ if (norm_path) {
+ wchar_t *slashes, *end, *new_path;
+ wcscpy(norm_path, module_path);
+ slashes = wcschr(norm_path, L'/');
+ while (slashes) {
+ *slashes = L'\\';
+ slashes = wcschr(slashes + 1, L'/');
+ }
+ end = wcsrchr(norm_path, L'\\') ? wcsrchr(norm_path, L'\\') : norm_path + wcslen(norm_path);
+ end[1] = L'\0';
+
+ new_path = (wchar_t *)alloca(sizeof(wchar_t) * (wcslen(L"PATH=") + wcslen(calculate->path_env) + 1 + wcslen(norm_path) + 1));
+ if (new_path) {
+ wcscpy(new_path, L"PATH=");
+ wcscat(new_path, calculate->path_env);
+ wcscat(new_path, L";");
+ wcscat(new_path, norm_path);
+ _wputenv(new_path);
+ }
+ }
+ }
+#endif
+
if ((!calculate->prefix_found || !calculate->exec_prefix_found) &&
calculate->warnings)
{