Skip to content

Commit

Permalink
Skip applying winetricks if no internet connection available. Fixes #25
Browse files Browse the repository at this point in the history
  • Loading branch information
GloriousEggroll committed Mar 8, 2024
1 parent e380449 commit 7c1aac0
Show file tree
Hide file tree
Showing 2 changed files with 696 additions and 123 deletions.
15 changes: 14 additions & 1 deletion util.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,25 @@ def is_custom_verb(verb):

return False

def check_internet():
"""Checks for internet connection."""
try:
urllib.request.urlopen("https://www.debian.org/", timeout=5)
return True
except urllib.error.URLError:
return False

def protontricks(verb):
""" Runs winetricks if available
"""

if not checkinstalled(verb):
if check_internet():
# Proceed with your function logic here
pass
else:
log.info("No internet connection. Winetricks will be skipped.")
return False

log.info('Installing winetricks ' + verb)
env = dict(protonmain.g_session.env)
env['WINEPREFIX'] = protonprefix()
Expand Down
Loading

0 comments on commit 7c1aac0

Please sign in to comment.