From 294ad9fae1e7657829bb18066e2978360f5dd53b Mon Sep 17 00:00:00 2001 From: doadin Date: Tue, 23 Sep 2014 14:23:42 -0400 Subject: [PATCH] [Extractor] Add Finding Win 7z Path via Registry --- deluge/plugins/extractor/extractor/core.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/deluge/plugins/extractor/extractor/core.py b/deluge/plugins/extractor/extractor/core.py index ff654b819..d3c0e047d 100644 --- a/deluge/plugins/extractor/extractor/core.py +++ b/deluge/plugins/extractor/extractor/core.py @@ -60,6 +60,17 @@ if windows_check(): 'C:\\Program Files\\7-Zip\\7z.exe', 'C:\\Program Files (x86)\\7-Zip\\7z.exe', ] + + import _winreg + try: + hkey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, "Software\\7-Zip") + except WindowsError: + pass + else: + win_7z_path = os.path.join(_winreg.QueryValueEx(hkey, "Path")[0], "7z.exe") + _winreg.CloseKey(hkey) + win_7z_exes.insert(1, win_7z_path) + switch_7z = "x -y" ## Future suport: ## 7-zip cannot extract tar.* with single command.