|
@@ -1420,7 +1420,7 @@ namespace Task
|
|
|
delete[] content;
|
|
|
return 4;//下载失败,算hash失败
|
|
|
}
|
|
|
- //不区分大小写比较文件hash
|
|
|
+ //不区分大小写比较文件hash /** 为什么有平台差异?? [Gifur@2025821]*/
|
|
|
#ifdef RVC_OS_WIN
|
|
|
if(stricmp(strMD5Val.GetData(),resp.sm3.c_str())==0){
|
|
|
#else
|
|
@@ -1431,12 +1431,7 @@ namespace Task
|
|
|
if(remove(dPackPath)==0){
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("delete download old pack succ ", dPackPath);
|
|
|
if(rename(dPackPathTemp.GetData(),dPackPath)!=0){
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- errMsg = CSimpleStringA::Format("exist old file,remove temp file fail, error=%d",(int)GetLastError()).GetData();
|
|
|
-#else
|
|
|
- errMsg = CSimpleStringA::Format("exist old file,remove temp file fail, error=%d", errno).GetData();
|
|
|
-#endif
|
|
|
+ errMsg = CSimpleStringA::Format("exist old file,remove temp file fail, error=%d", (int)GetLastError()).GetData();
|
|
|
LogWarn(Severity_Middle, Error_Exception, ERR_TASK_DOWNLOAD_PACK_FAIL,errMsg.GetData());
|
|
|
delete[] content;
|
|
|
return 4;//下载失败,移动文件失败
|
|
@@ -1445,24 +1440,14 @@ namespace Task
|
|
|
return 1;//成功返回
|
|
|
}
|
|
|
}else{
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- errMsg = CSimpleStringA::Format("delete download old pack fail ,error:%d",(int)GetLastError()).GetData();
|
|
|
-#else
|
|
|
- errMsg = CSimpleStringA::Format("delete download old pack fail ,error:%d", errno).GetData();
|
|
|
-#endif
|
|
|
+ errMsg = CSimpleStringA::Format("delete download old pack fail ,error:%d", (int)GetLastError()).GetData();
|
|
|
LogWarn(Severity_Middle, Error_Exception, ERR_TASK_DOWNLOAD_PACK_FAIL,errMsg.GetData());
|
|
|
delete[] content;
|
|
|
return 4;//下载失败,删除旧文件失败
|
|
|
}
|
|
|
}else{
|
|
|
if(rename(dPackPathTemp.GetData(),dPackPath)!=0){
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- errMsg = CSimpleStringA::Format("not exist old file,remove temp file fail, error=%d",(int)GetLastError()).GetData();
|
|
|
-#else
|
|
|
- errMsg = CSimpleStringA::Format("not exist old file,remove temp file fail, error=%d", errno).GetData();
|
|
|
-#endif
|
|
|
+ errMsg = CSimpleStringA::Format("not exist old file,remove temp file fail, error=%d", (int)GetLastError()).GetData();
|
|
|
LogWarn(Severity_Middle, Error_Exception, ERR_TASK_DOWNLOAD_PACK_FAIL,errMsg.GetData());
|
|
|
delete[] content;
|
|
|
return 4;//移动文件失败
|
|
@@ -1478,12 +1463,7 @@ namespace Task
|
|
|
if(remove(dPackPathTemp.GetData())==0){
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("delete download temp pack succ ,%s", dPackPathTemp.GetData());
|
|
|
}else{
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("delete download temp pack fail ,%s error:%d", dPackPathTemp.GetData(), GetLastError());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("delete download temp pack fail ,%s error:%d", dPackPathTemp.GetData(), errno);
|
|
|
-#endif
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("delete download temp pack fail ,%s error:%d", dPackPathTemp.GetData(), GetLastError());
|
|
|
}
|
|
|
delete[] content;
|
|
|
return 4;//下载失败,hash不对
|
|
@@ -1798,28 +1778,16 @@ ErrorCodeEnum CUpgradeTaskFSM::CreateNewVersion(CVersion NewSoftwareVersion,CSim
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("new version dir [%s] already exist, delete it", strNewVerPath.GetData());
|
|
|
if(!RemoveDirRecursiveA(strNewVerPath.GetData())){
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Create new version fail, delete already exist new version is fail:%d",GetLastError());
|
|
|
- strErrInfo = CSimpleStringA::Format("Create new version fail, delete already exist new version is fail:%d",(int)GetLastError());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Create new version fail, delete already exist new version is fail:%d", errno);
|
|
|
- strErrInfo = CSimpleStringA::Format("Create new version fail, delete already exist new version is fail:%d", errno);
|
|
|
-#endif
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Create new version fail, delete already exist new version is fail:%d", GetLastError());
|
|
|
+ strErrInfo = CSimpleStringA::Format("Create new version fail, delete already exist new version is fail:%d", (int)GetLastError());
|
|
|
return Error_Bug;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!CreateDirA(strNewVerPath.GetData(), TRUE))
|
|
|
{
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Create new version dir fail: %d", GetLastError());
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Create new version dir fail: %d", GetLastError());
|
|
|
strErrInfo = CSimpleStringA::Format("create new version dir fail: %d", (int)GetLastError());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Create new version dir fail: %d", errno);
|
|
|
- strErrInfo = CSimpleStringA::Format("create new version dir fail: %d", errno);
|
|
|
-#endif
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("create new version dir succ, dir = %s",strNewVerPath.GetData());
|
|
@@ -1938,12 +1906,7 @@ ErrorCodeEnum CUpgradeTaskFSM::ClearUpgradeFailVersion(CVersion NewSoftwareVersi
|
|
|
if (ExistsDirA(strNewVerPath.GetData()))
|
|
|
{
|
|
|
if(!RemoveDirRecursiveA(strNewVerPath.GetData())){
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ClearUpgradeFailVersion fail, delete temp Version [%s] is fail:%d",strNewVerPath.GetData(),(int)GetLastError());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ClearUpgradeFailVersion fail, delete temp Version [%s] is fail:%d", strNewVerPath.GetData(), errno);
|
|
|
-#endif
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ClearUpgradeFailVersion fail, delete temp Version [%s] is fail:%d", strNewVerPath.GetData(), (int)GetLastError());
|
|
|
return Error_Bug;
|
|
|
}else{
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ClearUpgradeFailVersion succ, delete temp Version [%s] ", strNewVerPath.GetData());
|
|
@@ -1996,18 +1959,10 @@ bool CUpgradeTaskFSM::GetSysUpgradeResult(const char *pszResultLog, CSimpleStrin
|
|
|
auto arr2 = arr[i].Split('=');
|
|
|
if (arr2.GetCount() == 2)
|
|
|
{
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
if (stricmp(arr2[0], "result") == 0)
|
|
|
eErrorCode = arr2[1];
|
|
|
else if (stricmp(arr2[0], "msg") == 0)
|
|
|
strErrMsg = arr2[1];
|
|
|
-#else
|
|
|
- if (strcmp(arr2[0], "result") == 0)
|
|
|
- eErrorCode = arr2[1];
|
|
|
- else if (strcmp(arr2[0], "msg") == 0)
|
|
|
- strErrMsg = arr2[1];
|
|
|
-#endif
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
@@ -2193,15 +2148,9 @@ int CUpgradeTaskFSM::ExecRunCmd(CSimpleStringA &strErrMsg,CInstallStep* ins)
|
|
|
int ret = system_on(sysPathStr,true,err);
|
|
|
osutil_reset_redirect_32sys_in_wow64(&store);
|
|
|
if(ret!=0){
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
//程序执行异常,结果未知
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ExecRunCmd is fail, system_on exec unknown ,err=%s",err.GetData());
|
|
|
- strErrMsg = CSimpleStringA::Format("ExecRunCmd is fail, system_on exec unknown ,err=%s",err.GetData());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ExecRunCmd is fail, system_on exec unknown , ret=%d, err=%s",ret, strerror(errno));
|
|
|
- strErrMsg = CSimpleStringA::Format("ExecRunCmd is fail, system_on exec unknown ret=%d, err=%s", ret, strerror(errno));
|
|
|
-#endif
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ExecRunCmd is fail, system_on exec unknown ,err=%s", err.GetData());
|
|
|
+ strErrMsg = CSimpleStringA::Format("ExecRunCmd is fail, system_on exec unknown ,err=%s", err.GetData());
|
|
|
return -1;//未知结果返回
|
|
|
|
|
|
}else{
|
|
@@ -2222,14 +2171,8 @@ int CUpgradeTaskFSM::ExecRunCmd(CSimpleStringA &strErrMsg,CInstallStep* ins)
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ExecRunCmd is succ,[%s] ", destPath.GetData());
|
|
|
return 1;//成功
|
|
|
}else{
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ExecRunCmd is fail,errorCode = %s", eErrorCode.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ExecRunCmd is fail,errorCode = %s", eErrorCode.GetData());
|
|
|
strErrMsg = CSimpleStringA::Format("ExecRunCmd is fail,errorCode = %s", eErrorCode.GetData());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ExecRunCmd is fail,errorCode = %s,%s", eErrorCode.GetData(), strErrMsg.GetData());
|
|
|
- strErrMsg = CSimpleStringA::Format("ExecRunCmd is fail,errorCode = %s,%s", eErrorCode.GetData(), strErrMsg.GetData());
|
|
|
-#endif
|
|
|
return 0;//失败
|
|
|
}
|
|
|
}
|
|
@@ -2652,17 +2595,12 @@ ErrorCodeEnum CUpgradeTaskFSM::CopyFileOperate(const char* srcPath, const char*
|
|
|
case 1:
|
|
|
{
|
|
|
if (bDestFileExists) {
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- bRet = CopyFileA(srcPath, destPath, FALSE);
|
|
|
-#else
|
|
|
if (fileutil_copy_file(destPath, srcPath) == 0) {
|
|
|
bRet = TRUE;
|
|
|
}
|
|
|
else {
|
|
|
bRet = FALSE;
|
|
|
}
|
|
|
-#endif
|
|
|
}
|
|
|
else {
|
|
|
LOG_TRACE("ignore file [%s] copy for dest file not exists", srcPath);
|
|
@@ -2671,34 +2609,25 @@ ErrorCodeEnum CUpgradeTaskFSM::CopyFileOperate(const char* srcPath, const char*
|
|
|
break;
|
|
|
case 2:
|
|
|
{
|
|
|
- if (!bDestFileExists)
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- bRet = CopyFileA(srcPath, destPath, TRUE);
|
|
|
-#else
|
|
|
- if (fileutil_copy_file(destPath, srcPath) == 0) {
|
|
|
- bRet = TRUE;
|
|
|
- }
|
|
|
- else {
|
|
|
- bRet = FALSE;
|
|
|
- }
|
|
|
-#endif
|
|
|
+ if (!bDestFileExists) {
|
|
|
+ if (fileutil_copy_file(destPath, srcPath) == 0) {
|
|
|
+ bRet = TRUE;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ bRet = FALSE;
|
|
|
+ }
|
|
|
+ }
|
|
|
else
|
|
|
LOG_TRACE("ignore file [%s] copy for dest file exists", srcPath);
|
|
|
}
|
|
|
break;
|
|
|
case 3:
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- bRet = CopyFileA(srcPath, destPath, FALSE);
|
|
|
-#else
|
|
|
if (fileutil_copy_file(destPath, srcPath) == 0) {
|
|
|
bRet = TRUE;
|
|
|
}
|
|
|
else {
|
|
|
bRet = FALSE;
|
|
|
}
|
|
|
-#endif
|
|
|
break;
|
|
|
case 4:
|
|
|
{
|
|
@@ -2714,12 +2643,7 @@ ErrorCodeEnum CUpgradeTaskFSM::CopyFileOperate(const char* srcPath, const char*
|
|
|
if (bRet){
|
|
|
RemoveFileReadOnlyAttributeA(destPath);
|
|
|
}else{
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
strErrMsg = CSimpleStringA::Format("CopyFileOperate copy file fail:%d", GetLastError());
|
|
|
-#else
|
|
|
- strErrMsg = CSimpleStringA::Format("CopyFileOperate copy file fail:%d", errno);
|
|
|
-#endif
|
|
|
}
|
|
|
ErrorCodeEnum rc = bRet ? Error_Succeed : Error_Unexpect;
|
|
|
return rc;
|
|
@@ -2739,12 +2663,7 @@ ErrorCodeEnum CUpgradeTaskFSM::SetRunSucceed(const char* pPackFile)
|
|
|
}
|
|
|
CSimpleStringA strSourcePath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", (const char*)strDownloadPath, pPackFile);
|
|
|
CSimpleStringA strDestPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", (const char*)strUpgradedPath, pPackFile);
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- CopyFileA(strSourcePath.GetData(), strDestPath.GetData(), FALSE);
|
|
|
-#else
|
|
|
fileutil_copy_file(strDestPath.GetData(), strSourcePath.GetData());
|
|
|
-#endif
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
|
|
@@ -3144,12 +3063,11 @@ bool CUpgradeTaskFSM::IsFileMatch(const char *pszFilter, const char *pszFileName
|
|
|
}
|
|
|
|
|
|
bool CUpgradeTaskFSM::RecursiveCopyDir(const char *pszSourceDir, const char *pszDestDir,CSimpleStringA &strErrInfo)
|
|
|
-{//TODO: CrossPlaform [Gifur@2025730]
|
|
|
+{
|
|
|
array_header_t *arr;
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
if (!ExistsDirA(pszSourceDir))
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("source dir [%s] not exists: %d", pszSourceDir,GetLastError());
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("source dir [%s] not exists: %d", pszSourceDir, GetLastError());
|
|
|
strErrInfo = CSimpleStringA::Format("source dir [%s] not exists: %d", pszSourceDir, GetLastError());
|
|
|
return false;
|
|
|
}
|
|
@@ -3159,32 +3077,11 @@ bool CUpgradeTaskFSM::RecursiveCopyDir(const char *pszSourceDir, const char *psz
|
|
|
if (!CreateDirRecursiveA(pszDestDir))
|
|
|
{
|
|
|
strErrInfo = CSimpleStringA::Format("create dir [%s] fail: %d", pszDestDir, GetLastError());
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("create dir fail: %s",strErrInfo.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create dir fail: %s", strErrInfo.GetData());
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
- //DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("create dir [%s] succ", pszDestDir);
|
|
|
- }
|
|
|
-#else
|
|
|
- if (!ExistsDirA(pszSourceDir))
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("source dir [%s] not exists: %d", pszSourceDir, errno);
|
|
|
- strErrInfo = CSimpleStringA::Format("source dir [%s] not exists: %d", pszSourceDir, errno);
|
|
|
- return false;
|
|
|
}
|
|
|
|
|
|
- if (!ExistsDirA(pszDestDir))
|
|
|
- {
|
|
|
- if (!CreateDirRecursiveA(pszDestDir))
|
|
|
- {
|
|
|
- strErrInfo = CSimpleStringA::Format("create dir [%s] fail: %d", pszDestDir, errno);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("create dir fail: %s",strErrInfo.GetData());
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- //DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("create dir [%s] succ", pszDestDir);
|
|
|
- }
|
|
|
-#endif
|
|
|
arr = fileutil_get_sub_files_a(pszSourceDir);
|
|
|
if (arr)
|
|
|
{
|
|
@@ -3197,24 +3094,13 @@ bool CUpgradeTaskFSM::RecursiveCopyDir(const char *pszSourceDir, const char *psz
|
|
|
if (szDestFile[strlen(szDestFile) - 1] != SPLIT_SLASH)
|
|
|
strcat(szDestFile, SPLIT_SLASH_STR);
|
|
|
strcat(szDestFile, strrchr(file, SPLIT_SLASH) + 1);
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- if (!CopyFileA(file, szDestFile, FALSE))
|
|
|
- {
|
|
|
- strErrInfo = CSimpleStringA::Format("copy file [%s] fail: %d", file, GetLastError());
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("copy file fail:%s",strErrInfo.GetData());
|
|
|
- toolkit_array_free2(arr);
|
|
|
- return false;
|
|
|
- }
|
|
|
-#else
|
|
|
- if (fileutil_copy_file(szDestFile, file)!=0)
|
|
|
+ if (fileutil_copy_file(szDestFile, file) != 0)
|
|
|
{
|
|
|
strErrInfo = CSimpleStringA::Format("copy file [%s] fail: %d", file, errno);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("copy file fail:%s",strErrInfo.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("copy file fail:%s", strErrInfo.GetData());
|
|
|
toolkit_array_free2(arr);
|
|
|
return false;
|
|
|
}
|
|
|
-#endif
|
|
|
}
|
|
|
toolkit_array_free2(arr);
|
|
|
}
|
|
@@ -3234,25 +3120,13 @@ bool CUpgradeTaskFSM::RecursiveCopyDir(const char *pszSourceDir, const char *psz
|
|
|
|
|
|
if (!RecursiveCopyDir(dir, szDestSubDir,strErrInfo))
|
|
|
{
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("copy dir [%s] fail: %d", dir, GetLastError());
|
|
|
- if(strErrInfo.IsNullOrEmpty()){
|
|
|
- strErrInfo = CSimpleStringA::Format("copy dir [%s] fail: %d", dir, GetLastError());
|
|
|
- }
|
|
|
- toolkit_array_free2(arr);
|
|
|
- return false;
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("copy dir [%s] fail: %d", dir, errno);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("copy dir [%s] fail: %d", dir, GetLastError());
|
|
|
if (strErrInfo.IsNullOrEmpty()) {
|
|
|
- strErrInfo = CSimpleStringA::Format("copy dir [%s] fail: %d", dir, errno);
|
|
|
+ strErrInfo = CSimpleStringA::Format("copy dir [%s] fail: %d", dir, GetLastError());
|
|
|
}
|
|
|
toolkit_array_free2(arr);
|
|
|
return false;
|
|
|
-#endif
|
|
|
}
|
|
|
-
|
|
|
- //DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("copy dir [%s] succ", dir);
|
|
|
}
|
|
|
toolkit_array_free2(arr);
|
|
|
}
|
|
@@ -3528,12 +3402,7 @@ ErrorCodeEnum CUpgradeTaskFSM::DeleteUnzipDir()
|
|
|
if (ExistsDirA(strUnzipDir.GetData()))
|
|
|
{
|
|
|
if(!RemoveDirRecursiveA(strUnzipDir.GetData())){
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("DeleteUnzipDir fail , temp unzip dir [%s] fail,err=%d",strUnzipDir.GetData(),(int)GetLastError());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("DeleteUnzipDir fail , temp unzip dir [%s] fail,err=%d",strUnzipDir.GetData(), errno);
|
|
|
-#endif
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("DeleteUnzipDir fail , temp unzip dir [%s] fail,err=%d", strUnzipDir.GetData(), (int)GetLastError());
|
|
|
return Error_Unexpect;
|
|
|
}else{
|
|
|
return Error_Succeed;
|
|
@@ -4023,7 +3892,7 @@ ErrorCodeEnum CUpgradeTaskFSM::loadCenterCfgInfo()
|
|
|
}
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
-//TODO: CrossPlaform [Gifur@2025730]
|
|
|
+//TODO: CrossPlaform 如果是获取文件大小,建议直接采用 fileutil中的 ReadFileSize [Gifur@2025730]
|
|
|
bool CUpgradeTaskFSM::GetFileLength(const char* filePath,long &fileLen)
|
|
|
{
|
|
|
FILE* file = fopen(filePath, "rb");
|
|
@@ -4701,28 +4570,16 @@ ErrorCodeEnum CUpgradeTaskFSM::CreateNewDepVersion(CSimpleStringA NewSoftwareVer
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("new version dir [%s] already exist, delete it", strNewVerPath.GetData());
|
|
|
if (!RemoveDirRecursiveA(strNewVerPath.GetData())) {
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Create new dep version fail, delete already exist new dep version is fail:%d", GetLastError());
|
|
|
strErrInfo = CSimpleStringA::Format("Create new dep version fail, delete already exist new dep version is fail:%d", (int)GetLastError());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Create new dep version fail, delete already exist new dep version is fail:%d", errno);
|
|
|
- strErrInfo = CSimpleStringA::Format("Create new dep version fail, delete already exist new dep version is fail:%d", errno);
|
|
|
-#endif
|
|
|
return Error_Bug;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!CreateDirA(strNewVerPath.GetData(), TRUE))
|
|
|
{
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Create new dep version dir fail: %d", GetLastError());
|
|
|
strErrInfo = CSimpleStringA::Format("create new dep version dir fail: %d", (int)GetLastError());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Create new dep version dir fail: %d", errno);
|
|
|
- strErrInfo = CSimpleStringA::Format("create new dep version dir fail: %d", errno);
|
|
|
-#endif
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("create new dep version dir succ, dir = %s", strNewVerPath.GetData());
|
|
@@ -4800,12 +4657,7 @@ ErrorCodeEnum CUpgradeTaskFSM::ClearUpgradeFailDepVersion(CSimpleStringA NewSoft
|
|
|
if (ExistsDirA(strNewVerPath.GetData()))
|
|
|
{
|
|
|
if (!RemoveDirRecursiveA(strNewVerPath.GetData())) {
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ClearUpgradeFailDepVersion fail, delete temp Version [%s] is fail:%d", strNewVerPath.GetData(), (int)GetLastError());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ClearUpgradeFailDepVersion fail, delete temp Version [%s] is fail:%d", strNewVerPath.GetData(), errno);
|
|
|
-#endif
|
|
|
return Error_Bug;
|
|
|
}
|
|
|
else {
|
|
@@ -5044,14 +4896,8 @@ int CUpgradeTaskFSM::ExecDepRunCmd(CSimpleStringA& strErrMsg, CInstallStep* ins)
|
|
|
osutil_reset_redirect_32sys_in_wow64(&store);
|
|
|
if (ret != 0) {
|
|
|
//程序执行异常,结果未知
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ExecRunCmd is fail, system_on exec unknown ,err=%s", err.GetData());
|
|
|
strErrMsg = CSimpleStringA::Format("ExecRunCmd is fail, system_on exec unknown ,err=%s", err.GetData());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ExecRunCmd is fail, system_on exec unknown , ret=%d, err=%s", ret, strerror(errno));
|
|
|
- strErrMsg = CSimpleStringA::Format("ExecRunCmd is fail, system_on exec unknown ret=%d, err=%s", ret, strerror(errno));
|
|
|
-#endif
|
|
|
return -1;//未知结果返回
|
|
|
}
|
|
|
else {
|
|
@@ -5073,14 +4919,8 @@ int CUpgradeTaskFSM::ExecDepRunCmd(CSimpleStringA& strErrMsg, CInstallStep* ins)
|
|
|
return 1;//成功
|
|
|
}
|
|
|
else {
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ExecRunCmd is fail,errorCode = %s", eErrorCode.GetData());
|
|
|
strErrMsg = CSimpleStringA::Format("ExecRunCmd is fail,errorCode = %s", eErrorCode.GetData());
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ExecRunCmd is fail,errorCode = %s,%s", eErrorCode.GetData(), strErrMsg.GetData());
|
|
|
- strErrMsg = CSimpleStringA::Format("ExecRunCmd is fail,errorCode = %s,%s", eErrorCode.GetData(), strErrMsg.GetData());
|
|
|
-#endif
|
|
|
return 0;//失败
|
|
|
}
|
|
|
}
|
|
@@ -5689,14 +5529,8 @@ bool CUpgradeTaskFSM::DownloadFileWrite(byte* content,long contentLen,const char
|
|
|
fclose(tempFp);
|
|
|
|
|
|
if(ret!=1){
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("DownloadFileWrite write file fail,ret = %d,errno = %d",ret,(int)GetLastError());
|
|
|
- return false;
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("DownloadFileWrite write file fail,ret = %d,errno = %d",ret, errno);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("DownloadFileWrite write file fail,ret = %d,errno = %d", ret, (int)GetLastError());
|
|
|
return false;
|
|
|
-#endif
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
@@ -5969,21 +5803,11 @@ bool CUpgradeTaskFSM::isWork()
|
|
|
if((!m_currentTask.NewVersion.IsNullOrEmpty())&&(m_currentTask.cPendingState=="T"||m_currentTask.cPendingState=="C"||m_currentTask.cPendingState=="X")){
|
|
|
CSimpleStringA strRunInfo,strStartTime;
|
|
|
if (m_pEntity->GetFunction()->GetPath("RunInfo",strRunInfo) == Error_Succeed){
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- strStartTime = strRunInfo + "\\runcfg\\starttime.dat";
|
|
|
-#else
|
|
|
- strStartTime = strRunInfo + "/runcfg/starttime.dat";
|
|
|
-#endif
|
|
|
+ strStartTime = strRunInfo + SPLIT_SLASH_STR "runcfg" SPLIT_SLASH_STR "starttime.dat";
|
|
|
if(!ExistsFileA(strStartTime.GetData())){
|
|
|
return true;//完成升级过程,通过
|
|
|
}else{
|
|
|
- //TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("upgrade process is not end ,file \\runcfg\\starttime is exist");
|
|
|
-#else
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("upgrade process is not end ,file /runcfg/starttime is exist");
|
|
|
-#endif
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("upgrade process is not end ,file %s is exist", strStartTime.GetData());
|
|
|
return false;//继续等待
|
|
|
}
|
|
|
}else{
|