From: 彭磊 <1624952103@qq.com> Date: Tue, 11 Jun 2024 02:01:23 +0000 (+0000) Subject: Merge #251 into sdk602patch0521 from refs/changes/251/head X-Git-Tag: release_V1.2.70_20241020_135402~1020^2~4^2~1 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=4f3e15fc757b49f27fcee3fc8abaa6e6ba45a039;p=mirrors%2FFD230.git Merge #251 into sdk602patch0521 from refs/changes/251/head Code review from 彭磊 * refs/changes/251/head: (8 commits squashed) - 添加蓝牙产测麦克风测试项,添加tar保存exc文件功能 - Merge branch 'sdk602patch0521' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into remotes/origin/sdk602patch0521 - 补交 - 补交 - Merge branch 'sdk602patch0521' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into remotes/origin/sdk602patch0521 - 优化麦克风蓝牙产测,优化tar保存死机文件 - Merge branch 'sdk602patch0521' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into remotes/origin/sdk602patch0521 - 优化tar保存exc文件 Signed-off-by: aliyun6865282430 <1624952103@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/251 --- diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index c27f6623d..2ceb17497 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -1597,6 +1597,15 @@ int uapi_save_exc(void) struct stat file_inf; int ret = 0; + if(access(folderPath, F_OK) == -1) + { + if(ret == -1) + { + PRINT("%s does not exist!!!\r\n", folderPath); + return -1; + } + } + dir = opendir(folderPath); if (dir == NULL) { @@ -1604,6 +1613,12 @@ int uapi_save_exc(void) return -1; } + if((entry = readdir(dir)) == NULL) + { + PRINT("%s is empty\r\n",folderPath); + return -1; + } + if(access(tarPath, F_OK) == -1) { ret = mkdir(tarPath, 0777); @@ -1669,6 +1684,7 @@ int uapi_save_exc(void) /* Close archive */ mtar_close(&tar); closedir(dir); + removeFilesInFolder(folderPath); return ret; }