Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
fix: 🐛 add base dir to constant
Browse files Browse the repository at this point in the history
  • Loading branch information
AnzhiZhang committed Jun 16, 2022
1 parent 7a6c2d1 commit 3b5cfee
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
13 changes: 11 additions & 2 deletions utils/constant.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import os
import sys

NAME = 'CurseForgeModpackDownloader'
NAME_WITH_SPACE = 'CurseForge Modpack Downloader (CMPDL)'

if getattr(sys, 'frozen', False):
BASE_DIR = getattr(sys, '_MEIPASS')
else:
BASE_DIR = os.getcwd()


class PATH:
ICON_PATH = 'icon.ico'
BASE_DIR = BASE_DIR
ICON_PATH = os.path.join(BASE_DIR, 'icon.ico')
TEMP_DIR_PATH = os.path.join(BASE_DIR, f'.{NAME}')
LOG_FILE_NAME = f'{NAME}.log'
TEMP_DIR_PATH = f'.{NAME}'


class WINDOW:
Expand Down
1 change: 0 additions & 1 deletion utils/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def main(self):
# 计算路径
self.file_base_name = os.path.basename(self.zip_file_path)
self.dir_path = os.path.join(
os.getcwd(),
PATH.TEMP_DIR_PATH,
self.file_base_name.replace('.zip', '')
)
Expand Down
2 changes: 1 addition & 1 deletion utils/window/frames/buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def run():
if modpack_id != -1 and file_name != '':
download_url = self.__main_window.show_frame.selected_download_url
avatar_url = self.__main_window.show_frame.selected_avatar_url
file_path = os.path.join(os.getcwd(), PATH.TEMP_DIR_PATH, file_name)
file_path = os.path.join(PATH.TEMP_DIR_PATH, file_name)

# Start download file
thread = Thread(target=run, name='Download')
Expand Down

0 comments on commit 3b5cfee

Please sign in to comment.