better method for getting documents folder

This commit is contained in:
Adam Saudagar 2020-10-13 20:05:11 +05:30
parent 21065e55ee
commit f6af3311da

View File

@ -136,8 +136,10 @@ def check_addon(name):
Extracts the addon from zip and installs it into the AddOn folder of eso Extracts the addon from zip and installs it into the AddOn folder of eso
""" """
try: try:
user = os.path.expanduser("~") # noinspection PyUnresolvedReferences
addon_dir = os.path.join(user, "Documents", "Elder Scrolls Online", "live", "Addons") from win32com.shell import shell, shellcon
documents = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, None, 0)
addon_dir = os.path.join(documents, "Elder Scrolls Online", "live", "Addons")
if not os.path.exists(os.path.join(addon_dir, name)): if not os.path.exists(os.path.join(addon_dir, name)):
logging.info(f"{name} Addon not found, installing it...") logging.info(f"{name} Addon not found, installing it...")
with ZipFile(manifest_file(f"{name}.zip"), 'r') as z: with ZipFile(manifest_file(f"{name}.zip"), 'r') as z: