确保deleteRecordDirectory接口忽略正在录制的mp4文件 (#3032)

This commit is contained in:
xiongziliang
2023-12-02 21:12:26 +08:00
parent 527d9b9e64
commit 22732ea3f4
2 changed files with 5 additions and 4 deletions

View File

@@ -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文件列表