mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-30 19:14:43 +00:00
Added ShellFolder registry utility function.
This commit is contained in:
parent
743e4a9d5d
commit
cbe6089b4e
1 changed files with 14 additions and 0 deletions
|
|
@ -83,3 +83,17 @@ def open_wordfile (app, filename):
|
|||
|
||||
def close_wordfile (doc):
|
||||
doc.Close()
|
||||
|
||||
|
||||
def get_shell_folder (name):
|
||||
"""Get Windows Shell Folder locations from the registry."""
|
||||
import _winreg
|
||||
lm = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)
|
||||
try:
|
||||
key = _winreg.OpenKey(lm, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
|
||||
try:
|
||||
return _winreg.QueryValueEx(key, name)[0]
|
||||
finally:
|
||||
key.Close()
|
||||
finally:
|
||||
lm.Close()
|
||||
|
|
|
|||
Loading…
Reference in a new issue