模块升级三级菜单判断路径逻辑修改

This commit is contained in:
xiehongyan 2024-01-18 19:14:24 +08:00
parent 1128c2771a
commit b66c732356

View File

@ -1431,26 +1431,27 @@ BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname)
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
char *strg_path = sf_get_root_path();
if(strg_path == NULL)
{
free(strg_path);
return FALSE;
}
dirp=opendir((char *)"/mnt/sd2/");
if ((dirp=opendir((char *)strg_path)) != NULL)
if (dirp != NULL)
{
//printf("[%s:%d] opendir success\n", __FUNCTION__, __LINE__);
while ((ptr=readdir(dirp)) != NULL)
{
//printf("[%s:%d] readdir success\n", __FUNCTION__, __LINE__);
if(strcmp(ptr->d_name,".")==0 || strcmp(ptr->d_name,"..")==0) ///current dir OR parrent dir
continue;
else if(ptr->d_type == 4) ///dir
{
if(SF_STRNCMP(ptr->d_name, puiPara->ModuleVer, 6) == 0)
//printf("[%s:%d] success strg_path:%s\n", __FUNCTION__, __LINE__, strg_path);
//printf("ptr->d_name: %s, puiPara->ModuleVer: %s\n", ptr->d_name, puiPara->ModuleVer);
if(strncmp(ptr->d_name, puiPara->ModuleVer, 6) == 0)
{
SF_SPRINTF(updateFname, "%s%s", strg_path, ptr->d_name);
sprintf((char*)updateFname, "%s%s", "/mnt/sd2/", ptr->d_name);
//sprintf((char*)updateFname, "%s%s", strg_path, ptr->d_name);
closedir(dirp);
printf("[%s:%d] updateFname:%s\n", __FUNCTION__, __LINE__, updateFname);
//free(strg_path);
printf("[%s:%d] success emmc strg_path:%s\n", __FUNCTION__, __LINE__, updateFname);
return TRUE;
}
}
@ -1460,9 +1461,34 @@ BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname)
}
}
}
dirp=opendir((char *)"/mnt/sd/");
if (dirp != NULL)
{
while ((ptr=readdir(dirp)) != NULL)
{
if(strcmp(ptr->d_name,".")==0 || strcmp(ptr->d_name,"..")==0) ///current dir OR parrent dir
continue;
else if(ptr->d_type == 4) ///dir
{
if(strncmp(ptr->d_name, puiPara->ModuleVer, 6) == 0)
{
sprintf((char*)updateFname, "%s%s", "/mnt/sd/", ptr->d_name);
closedir(dirp);
printf("[%s:%d] success sd card strg_path:%s\n", __FUNCTION__, __LINE__, updateFname);
return TRUE;
}
}
else
{
continue;
}
}
}
closedir(dirp);
free(strg_path);
printf("[%s:%d]==no update file\n", __FUNCTION__, __LINE__);
//free(strg_path);
printf("[%s:%d]no update file\n", __FUNCTION__, __LINE__);
return FALSE;
}
/*************************************************