This repository has been archived by the owner on Sep 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
ffxiv_tools.py
68 lines (53 loc) · 2.39 KB
/
ffxiv_tools.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
import platform
import sys
import os
if sys.platform == 'win32':
import winreg
def set_arch_keys():
if platform.machine().endswith('64'):
arch_keys = {winreg.KEY_WOW64_32KEY, winreg.KEY_WOW64_64KEY}
else:
arch_keys = {0}
return arch_keys
def get_installation_folder():
arch_keys = set_arch_keys()
for arch_key in arch_keys:
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", 0, winreg.KEY_READ | arch_key)
for i in range(0, winreg.QueryInfoKey(key)[0]):
skey_name = winreg.EnumKey(key, i)
skey = winreg.OpenKey(key, skey_name)
try:
display_name = winreg.QueryValueEx(skey, 'DisplayName')[0].lower()
if (
(display_name == "FINAL FANTASY XIV - A Realm Reborn".lower()) or
(display_name == "FINAL FANTASY XIV ONLINE".lower()) or
(display_name == "FINAL FANTASY XIV".lower())
):
install_location = winreg.QueryValueEx(skey, 'InstallLocation')[0] + "\\FINAL FANTASY XIV - A Realm Reborn"
skey.Close()
return install_location
except OSError:
pass
finally:
skey.Close()
def get_uninstall_exe():
arch_keys = set_arch_keys()
for arch_key in arch_keys:
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", 0, winreg.KEY_READ | arch_key)
for i in range(0, winreg.QueryInfoKey(key)[0]):
skey_name = winreg.EnumKey(key, i)
skey = winreg.OpenKey(key, skey_name)
try:
display_name = winreg.QueryValueEx(skey, 'DisplayName')[0].lower()
if (
(display_name == "FINAL FANTASY XIV - A Realm Reborn".lower()) or
(display_name == "FINAL FANTASY XIV ONLINE".lower()) or
(display_name == "FINAL FANTASY XIV".lower())
):
uninstall_exe = winreg.QueryValueEx(skey, 'UninstallString')[0]
skey.Close()
return uninstall_exe
except OSError:
pass
finally:
skey.Close()