This repository was archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfindMCC.py
More file actions
48 lines (47 loc) · 1.76 KB
/
Copy pathfindMCC.py
File metadata and controls
48 lines (47 loc) · 1.76 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
import os
location = ''
def findDir(name, path):
for root, dirs, files in os.walk(path):
if name in files:
global location
location = (os.path.join(root, name))
location = os.path.dirname(os.path.realpath(location))
return True
return False
def findMCC():
try:
file = os.getcwd() + '\\location.txt'
if os.stat(file).st_size == 0:
raise Exception("Location file is empty")
locationFile = open('location.txt', 'r')
steamdir = locationFile.read()
if not findDir('mcclauncher.exe', steamdir):
raise Exception("MCC is located in wrong directory")
locationFile.close()
return steamdir
except:
locationFile = open('location.txt', 'w')
# Find MCC Directory
findSteam64 = "C:\\Program Files\\"
findSteamx86 = "C:\\Program Files (x86)\\"
steamdir = ''
yes = ['y','ye','yes']
uInput = input("Is Halo: MCC located in the default Steam location?\n[Yes or No]: ")
global location
if uInput.lower() in yes:
if findDir('mcclauncher.exe', findSteamx86):
steamdir = location + '\\'
elif findDir('mcclauncher.exe', findSteam64):
steamdir = location + '\\'
else:
print('Halo: MCC not found')
else:
steamdir = input("Where is the directory containing Halo: MCC located?\nCopy/Paste here: ")
if findDir('mcclauncher.exe', steamdir):
steamdir = location + '\\'
else:
print("MCC directory not found")
steamdir = steamdir.replace(os.sep, '/')
locationFile.write(steamdir)
locationFile.close()
return steamdir