Update heartbeat.py

- 打包时会自动从临时目录而非当前目录复制配置文件样本
This commit is contained in:
yshtcn 2023-09-05 16:26:09 +08:00 committed by GitHub
parent 159ab9a839
commit af7ad40bfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,6 +120,8 @@ image = create_image()
config_path = os.path.join(current_dir, 'config.ini')
if not os.path.exists(config_path):
exsample_config_path = os.path.join(current_dir, 'config.Exsample.ini')
if getattr(sys, 'frozen', False):
exsample_config_path = os.path.join(sys._MEIPASS, 'config.Exsample.ini')
shutil.copyfile(exsample_config_path, config_path)
# 从配置文件读取设置