added support for alternate linux pathways

main
Nicholas Hope 2023-03-01 16:02:35 -05:00
parent db2d8c5e37
commit 15330c6901
1 changed files with 13 additions and 8 deletions

View File

@ -114,10 +114,9 @@ def getTargetDir(systemName):
+ ' like TF2 do not run. tfscript will run, but you can\'t run TF2' + ' like TF2 do not run. tfscript will run, but you can\'t run TF2'
+ ' on this system', + ' on this system',
category=RuntimeWarning ) category=RuntimeWarning )
return None
return expanduser('~/Library/Application Support/Steam') return expanduser('~/Library/Application Support/Steam')
elif systemName == 'Windows': if systemName == 'Windows':
# oh god why do we have to use the registry # oh god why do we have to use the registry
accessReg = ConnectRegistry(None, HKEY_LOCAL_MACHINE) accessReg = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
accessKey = OpenKey(accessReg, 'SOFTWARE\\WOW6432Node\\Valve\\Steam') accessKey = OpenKey(accessReg, 'SOFTWARE\\WOW6432Node\\Valve\\Steam')
@ -125,17 +124,23 @@ def getTargetDir(systemName):
while True: while True:
try: try:
accessSubkeyName, data, _ = EnumValue(accessKey, keyNum) accessSubkeyName, data, _ = EnumValue(accessKey, keyNum)
if accessSubkeyName == 'InstallPath':
return data
except EnvironmentError: except EnvironmentError:
break break
keyNum += 1 else:
if accessSubkeyName == 'InstallPath':
return data
keyNum += 1
return None return None
elif systemName == 'Linux': if systemName == 'Linux':
return expanduser('~/.local/share/Steam') 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) warn('Java-based OSes are not supported yet by tfscript.', category=RuntimeWarning)
return None return None