|
|
|
|
@ -1,6 +1,7 @@
@@ -1,6 +1,7 @@
|
|
|
|
|
#启动exe 文件 |
|
|
|
|
import os |
|
|
|
|
import subprocess |
|
|
|
|
import shutil |
|
|
|
|
import time |
|
|
|
|
import uiautomation as auto |
|
|
|
|
from utils.config import cfg |
|
|
|
|
@ -38,6 +39,15 @@ def start_exe(data):
@@ -38,6 +39,15 @@ def start_exe(data):
|
|
|
|
|
print(f"错误:工作目录不存在 - {exe_dir}") |
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
#清空data文件夹下的所有文件 |
|
|
|
|
data_dir = os.path.join(exe_dir, 'data') |
|
|
|
|
if os.path.exists(data_dir): |
|
|
|
|
# 删除该目录 |
|
|
|
|
shutil.rmtree(data_dir) |
|
|
|
|
|
|
|
|
|
if not os.path.exists(data_dir): |
|
|
|
|
os.makedirs(data_dir) |
|
|
|
|
|
|
|
|
|
# 使用 subprocess 启动,并设置工作目录 |
|
|
|
|
# 这样可以确保程序能找到同目录下的配置文件 |
|
|
|
|
try: |
|
|
|
|
|