From 15330c6901585c6c4b445fd81b44a92fb19cdfdd Mon Sep 17 00:00:00 2001 From: nick Date: Wed, 1 Mar 2023 16:02:35 -0500 Subject: [PATCH] added support for alternate linux pathways --- tfscript/cli.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tfscript/cli.py b/tfscript/cli.py index b4d35fd..8597ff4 100644 --- a/tfscript/cli.py +++ b/tfscript/cli.py @@ -114,10 +114,9 @@ def getTargetDir(systemName): + ' like TF2 do not run. tfscript will run, but you can\'t run TF2' + ' on this system', category=RuntimeWarning ) - return None return expanduser('~/Library/Application Support/Steam') - elif systemName == 'Windows': + if systemName == 'Windows': # oh god why do we have to use the registry accessReg = ConnectRegistry(None, HKEY_LOCAL_MACHINE) accessKey = OpenKey(accessReg, 'SOFTWARE\\WOW6432Node\\Valve\\Steam') @@ -125,17 +124,23 @@ def getTargetDir(systemName): while True: try: accessSubkeyName, data, _ = EnumValue(accessKey, keyNum) - if accessSubkeyName == 'InstallPath': - return data except EnvironmentError: break - keyNum += 1 + else: + if accessSubkeyName == 'InstallPath': + return data + keyNum += 1 return None - elif systemName == 'Linux': - return expanduser('~/.local/share/Steam') + if systemName == 'Linux': + homedir = expanduser('~') + for potentialdir in ['.steam/steam', '.local/share/Steam']: + fullTargetPath = normpath(f'{homedir}/{potentialdir}') + if isdir(fullTargetPath): + return fullTargetPath + return None - elif systemName == 'Java': + if systemName == 'Java': warn('Java-based OSes are not supported yet by tfscript.', category=RuntimeWarning) return None