From b7cb2f132211eea177309d7985afbf4a285887da Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Wed, 12 Jun 2024 15:40:18 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E5=88=A0=E9=99=A4=E6=96=87?= =?utf8?q?=E4=BB=B6=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- code/sdk/drivers/peripheral/utils/custom_utils.c | 13 ++++++++++--- code/sdk/drivers/peripheral/utils/custom_utils.h | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 18b76087b..630eea7ed 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -1587,8 +1587,8 @@ int removeFilesInFolder(const char *folderPath) closedir(dir); return ret; } - -void uapi_delete_files(const char *file_path) +/*删除文件*/ +int uapi_delete_files(const char *file_path) { struct stat s_buf; int ret = 0; @@ -1596,7 +1596,7 @@ void uapi_delete_files(const char *file_path) if(access(file_path, F_OK) == -1) { PRINT("%s does not exist!!!\r\n", file_path); - return; + return 0 ; } stat(file_path,&s_buf); if(S_ISDIR(s_buf.st_mode)) @@ -1604,9 +1604,16 @@ void uapi_delete_files(const char *file_path) else ret = remove(file_path); if(ret != 0) + { PRINT("%s remove failed !!! \r\n",file_path); + return 0; + } else + { PRINT("%s remove succeed !!! \r\n",file_path); + return 1; + } + } int uapi_tar_file(const char *src_path,const char *tar_path,char *tarfilename) diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index d59511514..574d8dbfa 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -177,7 +177,7 @@ uint32_t uapi_calendar_store_date(void); errcode_t uapi_custom_cmd_service_init(void); void do_custom_cmd_service_check_msg(int cmd, void *params, int paramlen); -void uapi_delete_files(const char *file_path); +int uapi_delete_files(const char *file_path); void uapi_restore_factory_setting(void); void custom_i2c_reset(void); -- 2.17.1