-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
75 lines (64 loc) · 2 KB
/
main.py
File metadata and controls
75 lines (64 loc) · 2 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import json
import os
import shutil
from util import yes_or_no, convert_path
import createStellarisPack
import util
DEFAULTS_PATH = os.path.join(os.path.curdir,"defaults.json")
def read_config_file():
# Check if the file exists
try:
if os.path.exists(DEFAULTS_PATH):
with open(DEFAULTS_PATH, "r") as file:
try:
defaults = json.load(file)
except json.JSONDecodeError:
print("Error decoding JSON")
else:
print(f"Config file not found.")
except Exception as e:
print("An error occurred:", str(e))
return defaults
def is_admin():
try:
return os.getuid() == 0
except:
return False
def sort_mods(e):
return e[3]
def main_help():
print("0: Create modpack")
print("A guided process for creating modpacks for a variety of games")
print("9: Help")
print("This is help")
def create_modpack_help():
print("Stellaris:")
print("A guided process to create a new modpack using an existing playset from the stellaris launcher. Make sure the mods in the playlist are already in "+
"the proper mod load order.")
def createModpack(defaults):
print("Which game is this modpack for?")
selection = input("0: Stellaris\n")
while True:
match selection:
case "0": #Stellaris
createStellarisPack.create_modpack(defaults)
break
case _:
print("Please retype answer")
break
if __name__ == '__main__':
# Load any default data
defaults = read_config_file()
print("Please type the number for what you would like to do:")
print("0: Create modpack")
selection = input("9: help\n")
while True:
match selection:
case "0":
createModpack(defaults)
break
case "9":
main_help()
break
case _:
print("Please retype answer")