From 164aca2d63c410b6dd30b950fda73d4a5a37b2cf Mon Sep 17 00:00:00 2001 From: Janne Pulkkinen Date: Wed, 7 Nov 2018 20:06:37 +0200 Subject: [PATCH] Use shutil.which to find 'winetricks' instead of hardcoded path --- protontricks | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/protontricks b/protontricks index a21c938..dddb19c 100755 --- a/protontricks +++ b/protontricks @@ -11,6 +11,7 @@ import binascii import glob import os import re +import shutil import string import struct import subprocess @@ -289,9 +290,11 @@ if __name__ == "__main__": if os.environ.get('WINETRICKS') is None: print("[INFO] WINETRICKS environment variable is not available. " - "Falling back to /usr/bin/winetricks") - os.environ["WINETRICKS"] = "/usr/bin/winetricks" - if not os.path.exists("/usr/bin/winetricks"): + "Searching from $PATH.") + winetricks_path = shutil.which("winetricks") + if winetricks_path: + os.environ["WINETRICKS"] = winetricks_path + else: print("[ERROR!] Winetricks isn't installed, please install " "winetricks in order to use this script!") prereq_fail = True