-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartup_sync.py
More file actions
40 lines (31 loc) · 1015 Bytes
/
startup_sync.py
File metadata and controls
40 lines (31 loc) · 1015 Bytes
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
import json
import os
import sys
from back.steam_manager import SteamManager
from back.epic_manager import EpicManager
if getattr(sys, 'frozen', False):
base_dir = os.path.dirname(sys.executable)
else:
base_dir = os.path.dirname(os.path.abspath(__file__))
CONFIG_FILE = os.path.join(base_dir, "config.json")
def main():
if not os.path.exists(CONFIG_FILE):
return
try:
with open(CONFIG_FILE, 'r', encoding='utf-8') as f:
config = json.load(f)
dest_path = config.get("shortcuts_path", "")
steam_paths = config.get("steamapps_paths", [])
sync_epic = config.get("sync_epic", True)
if not dest_path:
return
if steam_paths:
sm = SteamManager()
sm.sync_shortcuts(steam_paths, dest_path)
if sync_epic:
em = EpicManager()
em.sync_shortcuts(dest_path)
except Exception:
pass
if __name__ == "__main__":
main()