mirror of
https://github.com/moesnow/March7thAssistant.git
synced 2026-08-02 18:24:16 +08:00
refactor: path
This commit is contained in:
parent
d817333933
commit
0f84378967
11
app.py
11
app.py
@ -1,15 +1,6 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
if getattr(sys, 'frozen', False): # 检查是否是PyInstaller打包的可执行文件
|
||||
# 获取可执行文件所在目录并设置为工作目录
|
||||
app_dir = os.path.dirname(sys.executable)
|
||||
else:
|
||||
# 获取脚本所在目录并设置为工作目录
|
||||
app_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
os.chdir(app_dir) # 修改工作目录
|
||||
|
||||
os.chdir(os.path.dirname(sys.executable) if getattr(sys, 'frozen', False) else os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
10
main.py
10
main.py
@ -1,14 +1,6 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
if getattr(sys, 'frozen', False): # 检查是否是PyInstaller打包的可执行文件
|
||||
# 获取可执行文件所在目录并设置为工作目录
|
||||
app_dir = os.path.dirname(sys.executable)
|
||||
else:
|
||||
# 获取脚本所在目录并设置为工作目录
|
||||
app_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
os.chdir(app_dir) # 修改工作目录
|
||||
os.chdir(os.path.dirname(sys.executable) if getattr(sys, 'frozen', False) else os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from managers.notify_manager import notify
|
||||
from managers.logger_manager import logger
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user