File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -872,6 +872,32 @@ calculate_path(void)
872
872
else
873
873
wcsncpy (exec_prefix , _exec_prefix , MAXPATHLEN );
874
874
875
+ #ifdef MS_WINDOWS
876
+ if (_path ) {
877
+ wchar_t * module_path , * new_path ;
878
+ /* Add path of executable/dll to system path. This
879
+ * is so that the correct tcl??.dll and tk??.dll get used. */
880
+ path_buffer = _Py_char2wchar (_path , NULL );
881
+ module_path = dllpath [0 ] ? dllpath : progpath ;
882
+ new_path = (wchar_t * )alloca (sizeof (wchar_t )* (wcslen (L"PATH=" )+ wcslen (module_path )+ 1 + wcslen (path_buffer )+ 1 ));
883
+ if (new_path ) {
884
+ wchar_t * slashes , * end ;
885
+ wcscpy ( new_path , L"PATH=" );
886
+ wcscat ( new_path , module_path );
887
+ slashes = wcschr ( new_path , L'/' );
888
+ while (slashes ) {
889
+ * slashes = '\\' ;
890
+ slashes = wcschr ( slashes + 1 , L'/' );
891
+ }
892
+ end = wcsrchr (new_path , L'\\' ) ? wcsrchr (new_path , L'\\' ) : new_path + wcslen (new_path );
893
+ end [0 ] = L';' ;
894
+ end [1 ] = L'\0' ;
895
+ wcscat ( new_path , path_buffer );
896
+ _wputenv ( new_path );
897
+ PyMem_RawFree (path_buffer );
898
+ }
899
+ }
900
+ #endif
875
901
PyMem_RawFree (_pythonpath );
876
902
PyMem_RawFree (_prefix );
877
903
PyMem_RawFree (_exec_prefix );
You can’t perform that action at this time.
0 commit comments