thqby / ahk2_lib

MIT License
197 stars 26 forks source link

WebView2 fails to locate edge runtime #32

Closed gilleswaeber closed 8 months ago

gilleswaeber commented 8 months ago

Hi, it seems that the recent versions of the WebView2 installer will install the runtime in AppData\local instead of Program Files (x86), which breaks the search for the edge runtime on systems where the runtime is not pre-installed (Windows 8.1 and earlier).

Suggested fix, after line 35 in WebView2.ahk, add:

loop files A_AppData '\..\local\Microsoft\EdgeWebView\Application\*', 'D'
    if RegExMatch(A_LoopFilePath, '\\([\d.]+)$', &m) && VerCompare(m[1], ver) > 0
        edgeruntime := A_LoopFileFullPath, ver := m[1]

PS: thanks for this lib

thqby commented 8 months ago

Perhaps not selected to install for all users?

The runtime path and version can be specified in the parameters.

gilleswaeber commented 8 months ago

Indeed. While there's no explicit option for it, running the WebView2 installer as administrator will install it in the expected location.