Skip to content

Commit

Permalink
refactor: update temp_path
Browse files Browse the repository at this point in the history
  • Loading branch information
moesnow committed Jan 4, 2024
1 parent f2c623e commit bf12ac9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,4 @@ pyrightconfig.json
/logs
/screenshots
/3rdparty
/temp
4 changes: 3 additions & 1 deletion module/update/update_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
class UpdateHandler:
def __init__(self, download_url, cover_folder_path, extract_file_name):
self.exe_path = os.path.abspath("./assets/7z/7za.exe")
self.temp_path = tempfile.gettempdir()
self.temp_path = os.path.abspath("./temp")
if not os.path.exists(self.temp_path):
os.mkdir(self.temp_path)
self.download_url = download_url
self.download_file_path = os.path.join(self.temp_path, os.path.basename(download_url))
self.cover_folder_path = cover_folder_path
Expand Down
8 changes: 6 additions & 2 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def __init__(self, download_url=None):
"https://github.moeyy.xyz/https://raw.githubusercontent.com/moesnow/March7thAssistant/release/latest.json",
]

self.temp_path = tempfile.gettempdir()
self.temp_path = os.path.abspath("./temp")
if not os.path.exists(self.temp_path):
os.mkdir(self.temp_path)
if download_url is None:
self.__get_download_url()
else:
Expand Down Expand Up @@ -220,7 +222,9 @@ def check_temp_dir():
print("更新程序只支持打包成exe后运行")
sys.exit(1)

temp_path = tempfile.gettempdir()
temp_path = os.path.abspath("./temp")
if not os.path.exists(temp_path):
os.mkdir(temp_path)
file_path = os.path.abspath(sys.argv[0])
file_name = os.path.basename(file_path)
destination_path = os.path.join(temp_path, file_name)
Expand Down

0 comments on commit bf12ac9

Please sign in to comment.