37 lines
1.4 KiB
Diff
37 lines
1.4 KiB
Diff
diff -urN a/Modules/getpath.c b/Modules/getpath.c
|
|
--- a/Modules/getpath.c 2014-10-11 14:21:38.969394600 +0100
|
|
+++ b/Modules/getpath.c 2014-10-11 14:21:40.899505000 +0100
|
|
@@ -872,6 +872,32 @@
|
|
else
|
|
wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN);
|
|
|
|
+#ifdef MS_WINDOWS
|
|
+ if (_path) {
|
|
+ wchar_t *module_path, *new_path;
|
|
+ /* Add path of executable/dll to system path. This
|
|
+ * is so that the correct tcl??.dll and tk??.dll get used. */
|
|
+ path_buffer = _Py_char2wchar(_path, NULL);
|
|
+ module_path = dllpath[0] ? dllpath : progpath;
|
|
+ new_path = (wchar_t *)alloca(sizeof(wchar_t)*(wcslen(L"PATH=")+wcslen(module_path)+1+wcslen(path_buffer)+1));
|
|
+ if (new_path) {
|
|
+ wchar_t *slashes, *end;
|
|
+ wcscpy( new_path, L"PATH=" );
|
|
+ wcscat( new_path, module_path );
|
|
+ slashes = wcschr( new_path, L'/' );
|
|
+ while (slashes) {
|
|
+ *slashes = '\\';
|
|
+ slashes = wcschr( slashes+1, L'/' );
|
|
+ }
|
|
+ end = wcsrchr(new_path, L'\\') ? wcsrchr(new_path, L'\\') : new_path + wcslen(new_path);
|
|
+ end[0] = L';';
|
|
+ end[1] = L'\0';
|
|
+ wcscat( new_path, path_buffer );
|
|
+ _wputenv( new_path );
|
|
+ PyMem_RawFree(path_buffer);
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
PyMem_RawFree(_pythonpath);
|
|
PyMem_RawFree(_prefix);
|
|
PyMem_RawFree(_exec_prefix);
|