Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit d5132a0

Browse files
committed
fix: FileNotFoundException
fix bug optimize code via ignoring debugging files
1 parent 97612a7 commit d5132a0

6 files changed

Lines changed: 13 additions & 5775 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ Plain_Craft_Launcher_2/data/*.log
1313

1414
# Debugging Files
1515
**/.minecraft/
16+
**/dist/*
17+
nuitka-crash-report.xml

Plain_Craft_Launcher_2/Modules/Base/ModLogging.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
from enum import Enum
44
from traceback import format_exc as getTraceBack
55
from os import remove as removeFile, makedirs
6-
from os.path import exists
6+
from os.path import exists, dirname, abspath, join
7+
import sys
78

8-
launcher_data_folder = './logs'
9+
def get_program_dir():
10+
if getattr(sys, 'frozen', False):
11+
# Nuitka、PyInstaller 打包后
12+
return dirname(sys.executable)
13+
else:
14+
return dirname(abspath(__file__))
15+
16+
launcher_data_folder = join(get_program_dir(), 'logs')
917

1018
# 确保日志目录存在
1119
if not exists(launcher_data_folder):
@@ -102,8 +110,6 @@ def write(
102110
fatal.write(f'[FATAL] 错误类型:{type(ex).__name__}\n')
103111
fatal.write(f'[FATAL] 错误堆栈信息:\n{str(getTraceBack())}\n')
104112

105-
106-
107113
# Console Color Code, using f-string to insert, like {red}[Error]{clear}Exception
108114
clear = '\033[0m'
109115
black = '\033[30m'

Plain_Craft_Launcher_2/build.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nuitka --standalone --onefile --enable-plugin=pyqt5 --include-package=PyQt5 --include-package=PyQt5.QtSvg --include-package=PyQt5.QtCore --include-package=PyQt5.QtGui --include-package=PyQt5.QtWidgets --windows-icon-from-ico=.\Images\icon.ico --output-dir=..\dist --follow-imports --remove-output --assume-yes-for-downloads --show-progress --show-memory --include-data-dir=.\Images=Images --include-module=_ctypes --msvc=latest .\Application.py

0 commit comments

Comments
 (0)