删除再移除该目录
This commit is contained in:
1 parent
5236717598
commit
feb8cd380e
1 file changed
+10
@@ -1,6 +1,7 @@
|
|||||||
#启动exe 文件
|
#启动exe 文件
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import shutil
|
||||||
import time
|
import time
|
||||||
import uiautomation as auto
|
import uiautomation as auto
|
||||||
from utils.config import cfg
|
from utils.config import cfg
|
||||||
@@ -38,6 +39,15 @@ def start_exe(data):
|
|||||||
print(f"错误:工作目录不存在 - {exe_dir}")
|
print(f"错误:工作目录不存在 - {exe_dir}")
|
||||||
return False
|
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 启动,并设置工作目录
|
# 使用 subprocess 启动,并设置工作目录
|
||||||
# 这样可以确保程序能找到同目录下的配置文件
|
# 这样可以确保程序能找到同目录下的配置文件
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in new issue
Block a user