mirror of
https://github.com/yshtcn/heartbeat.git
synced 2026-01-28 16:51:53 +08:00
Update heartbeat.py
- 更新当前目录的兼容性,为打包提供支持
This commit is contained in:
@@ -14,6 +14,8 @@ import platform
|
|||||||
|
|
||||||
# 获取当前脚本所在的目录
|
# 获取当前脚本所在的目录
|
||||||
current_dir = os.path.dirname(os.path.realpath(__file__))
|
current_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
if getattr(sys, 'frozen', False):
|
||||||
|
current_dir = sys._MEIPASS # 如果是frozen的(即打包后的exe),使用这个目录
|
||||||
|
|
||||||
# 创建日志文件
|
# 创建日志文件
|
||||||
log_file_path = os.path.join(current_dir, 'heartbeat.log')
|
log_file_path = os.path.join(current_dir, 'heartbeat.log')
|
||||||
|
|||||||
Reference in New Issue
Block a user