forked from robbyz512/dota2-minify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmpaths.py
85 lines (73 loc) · 3.12 KB
/
mpaths.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import os
import winreg
import traceback
try:
hkey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\WOW6432Node\Valve\Steam")
except Exception as exception:
hkey = None
with open(os.path.join(os.getcwd(), 'logs\\registry.txt'), 'w') as file:
file.write(traceback.format_exc())
try:
steam_path = winreg.QueryValueEx(hkey, "InstallPath")
except:
steam_path = None
with open(os.path.join(os.getcwd(), 'logs\\registry_query.txt'), 'w') as file:
file.write(traceback.format_exc())
try:
steam_dir = steam_path[0]
except:
steam_dir = ""
# when dota2 is not inside Steam folder then set new steam directory from 'dota2path_minify.txt
# this text file is created and set by the user in validatefiles.py during startup
if not os.path.exists(os.path.join(steam_dir, 'steamapps\\common\\dota 2 beta\\game\\bin\\win64\\dota2.exe')):
path_file = os.path.join(os.getcwd(), 'dota2path_minify.txt')
# make sure the text file exists
if not os.path.exists(path_file):
with open(path_file,'a+') as file:
file.write('')
# load the path from text file
with open(path_file, 'r') as file:
for line in file:
steam_dir = line.strip()
# minify project paths
minify_dir = os.getcwd()
bin_dir = os.path.join(minify_dir, "bin")
build_dir = os.path.join(minify_dir, "build")
logs_dir = os.path.join(minify_dir, "logs")
mods_dir = os.path.join(minify_dir, "mods")
# bin
blank_files_dir = os.path.join(bin_dir, "blank-files")
maps_dir = os.path.join(bin_dir, "maps")
# dota2 paths
content_dir = os.path.join(steam_dir, "steamapps\\common\\dota 2 beta\\content\\dota_addons\\minify")
game_dir = os.path.join(steam_dir, "steamapps\\common\\dota 2 beta\\game\\dota_addons\\minify")
resource_compiler = os.path.join(steam_dir, "steamapps\\common\\dota 2 beta\\game\\bin\\win64\\resourcecompiler.exe")
pak01_dir = os.path.join(steam_dir, "steamapps\\common\\dota 2 beta\\game\\dota\\pak01_dir.vpk")
itembuilds_dir = os.path.join(steam_dir, "steamapps\\common\\dota 2 beta\\game\\dota\\itembuilds")
dota_minify_content = os.path.join(steam_dir, "steamapps\\common\\dota 2 beta\\content\\dota_minify")
dota_minify = os.path.join(steam_dir, "steamapps\\common\\dota 2 beta\\game\\dota_minify")
dota_minify_maps = os.path.join(dota_minify, "maps")
# exclude invalid mods
enabled_mods = ['Auto Accept Match',
'Dark Terrain',
'Dotabuff in Profiles',
'Minify Base Attacks',
'Minify HUD',
'Minify Spells & Items',
'Misc Optimization',
'Mute Ambient Sounds',
'Mute Taunt Sounds',
'Mute Voice Line Sounds',
'OpenDotaGuides Guides',
'Remove Foilage',
'Remove Pinging',
'Remove River',
'Remove Sprays',
'Remove Weather Effects',
'Saiyan Mod',
'Show NetWorth',
'Tree Mod',
]
mods_folders = []
for mod in os.listdir(mods_dir): mods_folders.append(mod)
mods_folders = [p for p in mods_folders if p in enabled_mods]