Skip to content

Commit

Permalink
Merge pull request #880 from greper/master
Browse files Browse the repository at this point in the history
fix: Fix the problem with comparing webView versions when version is 100.0.xxx
  • Loading branch information
r0x0r authored Apr 5, 2022
2 parents 9080f0f + 9c44b8b commit f3ff860
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions webview/platforms/winforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ def _is_edge():
finally:
winreg.CloseKey(net_key)

def _is_new_version(current_version, new_version):
new_range = new_version.split(".")
cur_range = current_version.split(".")
for index in range(len(new_range)):
if len(cur_range) > index:
return int(new_range[index]) >= int(cur_range[index])

return False

def _is_chromium():
def edge_build(key_type, key, description=''):
Expand All @@ -74,9 +82,8 @@ def edge_build(key_type, key, description=''):
register_key = rf'Computer\{key_type}\{path}'
windows_key = winreg.OpenKey(getattr(winreg, key_type), rf'SOFTWARE\{path}')
build, _ = winreg.QueryValueEx(windows_key, 'pv')
build = int(build.replace('.', '')[:6])

return build
return str(build)
except Exception as e:
# Forming extra information
extra_info = ''
Expand All @@ -94,7 +101,7 @@ def edge_build(key_type, key, description=''):
except:
pass

return 0
return '0'

try:
net_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full')
Expand All @@ -114,7 +121,7 @@ def edge_build(key_type, key, description=''):
for key_type in ('HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE'):
build = edge_build(key_type, item['key'], item['description'])

if build >= 860622: # Webview2 86.0.622.0
if _is_new_version('86.0.622.0', build): # Webview2 86.0.622.0
return True

except Exception as e:
Expand Down

0 comments on commit f3ff860

Please sign in to comment.