From 7c66aa0afeb5f9b9e5a4f7bd986cdf91dfd2b496 Mon Sep 17 00:00:00 2001 From: Mirhady Dorodjatun Date: Wed, 12 Jun 2024 18:29:23 +0700 Subject: [PATCH 1/2] fix: replace user documents folder with current folder. Fix attempt to write on user Documents folder while they doesnt have it. Due to several reason, one of them is the side effect of user using onedrive. --- mpaths.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mpaths.py b/mpaths.py index 6bb5920..f502500 100644 --- a/mpaths.py +++ b/mpaths.py @@ -27,8 +27,7 @@ # 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, 'common\dota 2 beta\game\bin\win64\dota2.exe')): - documents = os.path.join(os.path.expanduser('~'), 'Documents') - path_file = os.path.join(documents, 'dota2path_minify.txt') + path_file = os.path.join(os.getcwd(), 'dota2path_minify.txt') # make sure the text file exists if not os.path.exists(path_file): From ecdfe4a42f9d625682cde27a12fd44567274bda4 Mon Sep 17 00:00:00 2001 From: Mirhady Dorodjatun Date: Wed, 12 Jun 2024 19:08:58 +0700 Subject: [PATCH 2/2] fix: forward slash in path didnt escaped properly. --- mpaths.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mpaths.py b/mpaths.py index f502500..172ade1 100644 --- a/mpaths.py +++ b/mpaths.py @@ -6,7 +6,7 @@ from urllib.request import urlopen try: - hkey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\WOW6432Node\Valve\Steam") + 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: @@ -26,7 +26,7 @@ # 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, 'common\dota 2 beta\game\bin\win64\dota2.exe')): +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