forked from sw2719/steam-account-switcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
steamswitcher.py
52 lines (44 loc) · 1.26 KB
/
steamswitcher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import sys
import os
import shutil
from modules.config import first_run
from modules.update import start_checkupdate
from modules.main import MainApp
VERSION = '2.7'
BRANCH = 'master'
URL = ('https://raw.githubusercontent.com/sw2719/steam-account-switcher/%s/version.yml' % BRANCH)
print('Launch arguments:', sys.argv)
after_update = False
if '-debug' in sys.argv:
BUNDLE = False
elif getattr(sys, 'frozen', False):
BUNDLE = True
if os.path.isdir('updater'):
try:
shutil.rmtree('updater')
except OSError:
pass
if os.path.isfile('update.zip'):
after_update = True
try:
os.remove('update.zip')
except OSError:
pass
print('Running in a bundle')
else:
BUNDLE = False
print('Running in a Python interpreter')
if '-logfile' in sys.argv:
std_out = open('log.txt', 'w', encoding='utf-8')
std_err = std_out
sys.stdout = std_out
sys.stderr = std_out
else:
std_out = sys.__stdout__
std_err = sys.__stderr__
root = MainApp(VERSION, URL, BUNDLE, std_out, std_err, after_update)
root.after(100, lambda: start_checkupdate(root, VERSION, URL, BUNDLE))
if first_run or after_update:
root.after(200, root.welcomewindow)
print('Init complete.')
root.mainloop()