From 22732ea3f4edfc1ef6439ad77cc88e9303f7bd30 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 2 Dec 2023 21:12:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A1=AE=E4=BF=9DdeleteRecordDirectory?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BF=BD=E7=95=A5=E6=AD=A3=E5=9C=A8=E5=BD=95?= =?UTF-8?q?=E5=88=B6=E7=9A=84mp4=E6=96=87=E4=BB=B6=20(#3032)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- server/WebApi.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 7a403274..f8471ab1 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 7a403274c385f59a7eefd5474a05a05139220ee6 +Subproject commit f8471ab1e6810358646f39e72f9ea035b1458363 diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 6b069a8c..59f44f66 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -1547,20 +1547,21 @@ void installWebApi() { } val["path"] = record_path; if (!recording) { - val["code"] = File::delete_file(record_path); + val["code"] = File::delete_file(record_path, true); return; } File::scanDir(record_path, [](const string &path, bool is_dir) { if (is_dir) { return true; } - if (path.find("./") != std::string::npos) { + if (path.find("/.") == std::string::npos) { File::delete_file(path); } else { TraceL << "Ignore tmp mp4 file: " << path; } return true; - }, true); + }, true, true); + File::deleteEmptyDir(record_path); }); //获取录像文件夹列表或mp4文件列表