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."); }