Skip to content

Commit

Permalink
Fix Windows registry access mode when adding icons to file type assoc…
Browse files Browse the repository at this point in the history
…iations (#206)

* Open icon subkey with write access

* Add icon to file_types test file

* Add news item

* Add icon only to Windows tests

* Remove accidental tab

* Update tests/data/jsons/file_types.json

Co-authored-by: jaimergp <jaimergp@users.noreply.github.com>

---------

Co-authored-by: jaimergp <jaimergp@users.noreply.github.com>
  • Loading branch information
marcoesters and jaimergp committed May 10, 2024
1 parent fc5d064 commit 2416e74
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion menuinst/platforms/win_utils/registry.py
Expand Up @@ -72,7 +72,7 @@ def register_file_extension(extension, identifier, command, icon=None, mode="use
log.debug("Created registry entry for command '%s'", command)

if icon:
subkey = winreg.OpenKey(key, identifier)
subkey = winreg.OpenKey(key, identifier, access=winreg.KEY_SET_VALUE)
winreg.SetValueEx(subkey, "DefaultIcon", 0, winreg.REG_SZ, icon)
log.debug("Created registry entry for icon '%s'", icon)

Expand Down
19 changes: 19 additions & 0 deletions news/206-file-extensions-regkey-access
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Fix Windows registry key access mode when adding icon file to file type association. (#191 via #206)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
1 change: 1 addition & 0 deletions tests/data/jsons/file_types.json
Expand Up @@ -14,6 +14,7 @@
],
"platforms": {
"win": {
"icon": "doesnotexistbutitsok.{{ ICON_EXT }}",
"command": [
"{{ PYTHON }}",
"-c",
Expand Down

0 comments on commit 2416e74

Please sign in to comment.