bpo-30374: Fixed several bugs in win_add2path.py by XDcsy · Pull Request #1594 · python/cpython (original) (raw)
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation1 Commits5 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
- Discard the DEFAULT "%PATH%" value. The system PATH is global to all users so adding "%PATH%" in user PATH is unnecessary.
- The directory of userscripts does not exist when Python is just installed. This causes the
os.path.isdir()
to always return False. But it is very possible that the directory will be created later so the path should be kept there. Thusos.path.isdir()
check is unnecessary and is now deleted. - The script compulsively sets the type of PATH var to REG_EXPAND_SZ. Now the type remains what it is. If it's REG_SZ, the
%APPDATA%...
path will not be added and the absolute path of it will be added instead. - The current script needs users to log off and then log back on to take effect. Now it takes effect immediately by broadcasting a
WM_SETTINGCHANG
message after the change of env vars. - Now displays error massages when fails to load PATH values or fails to refresh env vars.
The current script needs you to log off and then log back on to take effect.
Now it takes effect immediately by broadcasting a WM_SETTINGCHANG
message after the change of environment variables.
Or just have the installer use an statically linked editenv library to do it all for you. That is what I do with my own pthmgr project at https://github.com/DecoraterBot-devs/pthmgr.
Although if my 'pthmgr' was part of Windows it would help with the installer and so then the installer would call the program I made. Yes, it is made using C++ and requires administrator to use but it works and broadcasts it anyway. However no version of Windows ship it and I am wiling to give the project to Microsoft or the PSF as well. However there is yet to find a way for it to hack any running instances of cmd.exe or powershell that would update the path on them without restarting it similar to how you can on Linux. If someone has an idea on that that does not require an dll injection to them to do it would help with it a lot.
- Discard the DEFAULT "%PATH%" value. The system PATH is global to all users so adding "%PATH%" in user PATH is unnecessary.
- The directory of userscripts does not exist when Python is just installed. This causes the
os.path.isdir()
to always return False. But it is very possible that the directory will be created later so keep the path added is reasonable. Thusos.path.isdir()
check is unnecessary and is now deleted. - The script compulsively sets the type of PATH var to REG_EXPAND_SZ. Now the type remains what it is. If it's REG_SZ, the
%APPDATA%...
path will not be added while the other absolute paths are normally added. - The current script needs users to log off and then log back on to take effect. Now it takes effect immediately by broadcasting a
WM_SETTINGCHANG
message after the change of env vars. - Now displays error massages when PATH fails to load PATH values or fails to refresh env vars.
XDcsy changed the title
bpo-30374: Refresh environment variables after adding Python to PATH bpo-30374: Fixed several bugs in win_add2path.py
If the type is REG_SZ, the %APPDATA%...
path will not be added and the absolute path will be added instead.
2 participants