[Windows] Fix for Custom Chrome Installations

This commit fixes that error when you had an custom chrome installation. For example: D:\Chromium or something.
Now it uses windows PATH to start chrome and if there's no PATH installation script would check default location.

Here's demo for current bug: https://youtu.be/O8lPblnBIGQ
This commit is contained in:
Alex
2025-04-03 10:55:45 +03:00
parent ea44218a8a
commit 3c12561997
3 changed files with 112 additions and 8 deletions

View File

@@ -13,6 +13,15 @@ def get_user_documents_path():
def get_default_chrome_path():
"""Get default Chrome path"""
if sys.platform == "win32":
# Trying to find chrome in PATH
try:
import shutil
chrome_in_path = shutil.which("chrome")
if chrome_in_path:
return chrome_in_path
except:
pass
# Going to default path
return r"C:\Program Files\Google\Chrome\Application\chrome.exe"
elif sys.platform == "darwin":
return "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"