download ui file if it doesn't exist
This commit is contained in:
parent
1ac531b71f
commit
7eede149c6
|
@ -12,29 +12,40 @@ from PyQt5.QtWidgets import *
|
|||
from PyQt5 import uic
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from urllib.request import urlopen
|
||||
from urllib.request import urlretrieve
|
||||
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print('Missing arguments')
|
||||
sys.exit()
|
||||
|
||||
else:
|
||||
if 'debug' in sys.argv:
|
||||
args = ['/home/zoey/.steam/steam/steamapps/common/Proton 5.0/proton', 'waitforexitandrun', '/home/zoey/.steam/steam/steamapps/common/BorderlandsGOTYEnhanced/Binaries/Win64/Launcher.exe']
|
||||
elif 'debug' in sys.argv:
|
||||
args = ['/home/zoey/.steam/steam/steamapps/common/Proton 5.0/proton', 'waitforexitandrun', '/home/zoey/.steam/steam/steamapps/common/BorderlandsGOTYEnhanced/Binaries/Win64/Launcher.exe']
|
||||
|
||||
else:
|
||||
args = sys.argv[1:]
|
||||
elif 'generate' in sys.argv:
|
||||
print('Steam launch options:', Path(__file__).resolve(), '%command%')
|
||||
sys.exit()
|
||||
|
||||
else:
|
||||
args = sys.argv[1:]
|
||||
|
||||
|
||||
datapath = Path('~/.config/barkshark/proton-launcher').expanduser()
|
||||
configfile = datapath.joinpath('config.json')
|
||||
gamelist = datapath.joinpath('games.json')
|
||||
uifile = Path(__file__).resolve().parent.joinpath('gamelaunch.ui')
|
||||
localuifile = Path(__file__).resolve().parent.joinpath('gamelaunch.ui')
|
||||
uifile = datapath.joinpath('gamelaunch.ui')
|
||||
|
||||
if not datapath.exists():
|
||||
datapath.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if localuifile.exists():
|
||||
uifile = localuifile
|
||||
|
||||
elif not uifile.exists():
|
||||
print('Downloading ui file')
|
||||
urlretrieve('https://git.barkshark.xyz/izaliamae/scripts/raw/branch/master/gamelaunch.ui', uifile)
|
||||
|
||||
config = json.load(configfile.open()) if configfile.exists() else {'auto_start': True, 'auto_close': True}
|
||||
games = {
|
||||
'default': {
|
||||
|
|
Loading…
Reference in a new issue