forked from SummoningWars/summoning-wars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrorchecker.py
62 lines (52 loc) · 1.69 KB
/
errorchecker.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
53
54
55
56
57
58
59
60
61
62
# this script checks for common errors when running and building sumwars for linux
# run this script in your sumwars folder where the executable is
import os.path
#check if executable exists
f = "./sumwars"
if os.path.isfile(f):
print("Checking for " + f + ": Ok")
else:
print("Checking for " + f + ": Failure! Please check the location")
#check if plugins.cfg exists
f = "./plugins.cfg"
if os.path.isfile(f):
print("Checking for " + f + ": Ok")
pluginsfolder = ""
of = open(f)
try:
for line in of:
if line.startswith("PluginFolder="):
pluginsfolder = line.replace("PluginFolder=", "").rstrip()
#plugin folder name found, check if it exists
if os.path.exists(pluginsfolder):
print("Checking for " + pluginsfolder + ": Ok")
else:
print("Checking for " + pluginsfolder + ": Failure! Please check the file location")
finally:
of.close()
else:
print("Checking for " + f + ": Failure! Please check the file location")
#check if resources.cfg exists
f = "./resources.cfg"
if os.path.isfile(f):
print("Checking for " + f + ": Ok")
else:
print("Checking for " + f + ": Failure! Please check the file location")
#check if resources folder exists
f = "./resources"
if os.path.exists(f):
print("Checking for " + f + ": Ok")
else:
print("Checking for " + f + ": Failure! Please check the path location")
#check if data folder exists
f = "./data"
if os.path.exists(f):
print("Checking for " + f + ": Ok")
else:
print("Checking for " + f + ": Failure! Please check the path location")
#check if save folder exists
f = "./save"
if os.path.exists(f):
print("Checking for " + f + ": Ok")
else:
print("Checking for " + f + ": Failure! Please check the path location")