From 05678a7944046b4042d639664351fda29b2ea85f Mon Sep 17 00:00:00 2001 From: "CSSC-WORK\\murmur" Date: Mon, 11 Sep 2023 18:04:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B8=85=E7=A9=BA=E5=89=8D?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=8A=9F=E8=83=BD=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=A0=E9=99=A4tosend.ini=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/func/func.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/applications/func/func.c b/applications/func/func.c index d67bed5..8fbd6a8 100644 --- a/applications/func/func.c +++ b/applications/func/func.c @@ -22,6 +22,7 @@ extern rt_sem_t okToreport; extern void resetTM(void); unsigned long getFileSize(char *file); void updateSysRTC(uint8_t *din, size_t len); +int isFileExit(char *f); #define CFG_ACK /** * 配置文件后的ack信号 @@ -956,8 +957,13 @@ void clearAllData() //去掉原static //static int cmd_rm(int argc, char **argv) //MSH_CMD_EXPORT_ALIAS(cmd_rm, rm, Remove(unlink) the FILE(s).); - char *arg[]={"rm","-r",ROOT_PATH_DATA}; - cmd_rm(3,arg); + DIR *dir = opendir(ROOT_PATH_DATA); + if (dir && isFileExit("/sd/tosend.ini")) + { + closedir(dir); + char *arg[]={"rm","-r",ROOT_PATH_DATA,"/sd/tosend.ini" }; + cmd_rm(4,arg); + } LOG_D("files deleted."); }