|
@@ -2584,33 +2584,44 @@ int ResourceWatcherFSM::ProcessFileDelete(LPCTSTR lpszPath, int& nDelSucCnt, int
|
|
|
|
|
|
BOOL ResourceWatcherFSM::DeleteVersionPackage()
|
|
|
{
|
|
|
-#ifdef RVC_OS_LINUX
|
|
|
BOOL bRet = FALSE;
|
|
|
ErrorCodeEnum erroCode = Error_Succeed;
|
|
|
CSmartPointer<IEntityFunction> pFunc = GetEntityBase()->GetFunction();
|
|
|
CSmartPointer<IConfigInfo> spConfigRun;
|
|
|
+ CSmartPointer<IConfigInfo> spConfig;
|
|
|
CSystemStaticInfo info;
|
|
|
if (pFunc->GetSystemStaticInfo(info) != Error_Succeed) {
|
|
|
LogError(Severity_Middle, erroCode, 0, "Get system static info error");
|
|
|
return FALSE;
|
|
|
}
|
|
|
- Dbg("Current version: %s", (LPCTSTR)info.InstallVersion.ToString());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Current version: %s", (LPCTSTR)info.InstallVersion.ToString());
|
|
|
|
|
|
+ //判断是否需要被清理
|
|
|
int nLastTaskTime = 0;
|
|
|
int nLstFlag = 0;
|
|
|
+ int nDelCount = 0;
|
|
|
UINT64 utVersion = 0;
|
|
|
+
|
|
|
+ int verSaved = DEFAULT_VERSION_SAVED_COUNT;
|
|
|
+ int tmpSaved = 0;
|
|
|
+ pFunc->OpenConfig(Config_CenterSetting, spConfig);
|
|
|
+ spConfig->ReadConfigValueInt("VersionSaved", "default", tmpSaved);
|
|
|
+ if (tmpSaved > DEFAULT_VERSION_SAVED_COUNT) {
|
|
|
+ verSaved = tmpSaved;
|
|
|
+ }
|
|
|
+
|
|
|
pFunc->OpenConfig(Config_Run, spConfigRun);
|
|
|
spConfigRun->ReadConfigValueHexInt("VersionClear", "OptVer", utVersion);
|
|
|
- spConfigRun->ReadConfigValueInt("VersionClear", "LastCondi", nLstFlag); //last times is failed or not? failed:true
|
|
|
+ spConfigRun->ReadConfigValueInt("VersionClear", "DelVerCnt", nDelCount);
|
|
|
+ spConfigRun->ReadConfigValueInt("VersionClear", "LastCondi", nLstFlag);
|
|
|
spConfigRun->ReadConfigValueInt("VersionClear", "LastTime", nLastTaskTime);
|
|
|
|
|
|
CVersion optVer(utVersion);
|
|
|
SYSTEMTIME stTaskTime = CSmallDateTime(nLastTaskTime).ToSystemTime();
|
|
|
- Dbg("LastTime<%04d-%02d-%02d %02d:%02d:%02d>: OptVer: %s, LastCondi: %d",
|
|
|
- stTaskTime.wYear, stTaskTime.wMonth, stTaskTime.wDay,
|
|
|
- stTaskTime.wHour, stTaskTime.wMinute, stTaskTime.wSecond,
|
|
|
- (LPCTSTR)optVer.ToString(), nLstFlag);
|
|
|
-
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("LastTime<%04d-%02d-%02d %02d:%02d:%02d>: OptVer: %s, LastCondi: %d",
|
|
|
+ stTaskTime.wYear, stTaskTime.wMonth, stTaskTime.wDay,
|
|
|
+ stTaskTime.wHour, stTaskTime.wMinute, stTaskTime.wSecond,
|
|
|
+ (LPCTSTR)optVer.ToString(), nLstFlag);
|
|
|
//判断是否需要被清理
|
|
|
if (optVer.IsValid() && optVer == info.InstallVersion && !nLstFlag) {
|
|
|
Dbg("VersionPackage cleaning has been done before.");
|
|
@@ -2619,17 +2630,15 @@ BOOL ResourceWatcherFSM::DeleteVersionPackage()
|
|
|
|
|
|
CSimpleStringA strRunInfo, strStartTime;
|
|
|
if (m_pEntity->GetFunction()->GetPath("RunInfo", strRunInfo) == Error_Succeed) {
|
|
|
- strStartTime = strRunInfo + "/runcfg/starttime.dat";
|
|
|
+ strStartTime = strRunInfo + SPLIT_SLASH_STR + "runcfg" + SPLIT_SLASH_STR + "starttime.dat";
|
|
|
if (!ExistsFileA(strStartTime.GetData())) {
|
|
|
- Dbg("upgrade porcess done, try to delete version files.");//完成升级过程,通过
|
|
|
- }
|
|
|
- else {
|
|
|
- Dbg("upgrade process is not end ,should not delete version files.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("upgrade prpcess done, try to delete version files.");//完成升级过程,通过
|
|
|
+ } else {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("upgrade process is not end ,should not delete version files.");
|
|
|
return FALSE;//升级未完成,不进行删除
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
- Dbg("upgrade process is not end ,get runinfo path is error, should not delete version files.");
|
|
|
+ } else {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("upgrade process is not end ,get runinfo path is error, should not delete version files.");
|
|
|
return FALSE;//失败,继续等待
|
|
|
}
|
|
|
|
|
@@ -2637,25 +2646,28 @@ BOOL ResourceWatcherFSM::DeleteVersionPackage()
|
|
|
CSimpleStringA csPath;
|
|
|
ErrorCodeEnum Error = m_pEntity->GetFunction()->GetPath("RootVer", csPath); //获取当前版本路劲 例如:C:\Run
|
|
|
if (Error_Succeed == Error) {
|
|
|
- if (csPath.IsNullOrEmpty())
|
|
|
- {
|
|
|
- Dbg("get currVer path is null");
|
|
|
+ if (csPath.IsNullOrEmpty()) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("get currVer path is null");
|
|
|
return FALSE;
|
|
|
+ } else {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("CUR VERSION PATH = %s.", csPath.GetData());
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- /*csPath.Append("/version");*/
|
|
|
- Dbg("CUR VERSION PATH = %s.", csPath.GetData());
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- Dbg("get upgradeVer path is error");
|
|
|
+ } else {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("get Ver path error");
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
- //vector<CInstallInfoEx> intallInfoVects;
|
|
|
vector<CVersion> intallInfoVects;
|
|
|
vector<string> files;
|
|
|
+
|
|
|
+ CSimpleStringA upPath;
|
|
|
+ ErrorCodeEnum upError = pFunc->GetPath("Upgraded", upPath);
|
|
|
+ if (Error_Succeed != upError) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("get Upgraded path error");
|
|
|
+ return FALSE;
|
|
|
+ }
|
|
|
+
|
|
|
+#ifdef RVC_OS_LINUX
|
|
|
DIR* dp;
|
|
|
struct dirent* dirp;
|
|
|
|
|
@@ -2667,31 +2679,24 @@ BOOL ResourceWatcherFSM::DeleteVersionPackage()
|
|
|
int n = sscanf(dirp->d_name, "%d.%d.%d.%d", &dwMajor, &dwMinor, &dwRevision, &dwBuild);
|
|
|
if (n != 4)
|
|
|
{
|
|
|
- Dbg("Not version file.[%s]", dirp->d_name);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Not version file.[%s]", dirp->d_name);
|
|
|
continue;
|
|
|
}
|
|
|
else {
|
|
|
CVersion verName(dwMajor, dwMinor, dwRevision, dwBuild);
|
|
|
if (verName.IsValid() && verName < info.InstallVersion) //对高于自身版本的文件不予删除
|
|
|
{
|
|
|
- //verInfo.InstallVersion = verName;
|
|
|
intallInfoVects.push_back(verName);
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("Not version file.[%s]", dirp->d_name);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Not version file.[%s]", dirp->d_name);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
closedir(dp);
|
|
|
}
|
|
|
|
|
|
- CSimpleStringA upPath;
|
|
|
- ErrorCodeEnum upError = m_pEntity->GetFunction()->GetPath("Upgraded", upPath);
|
|
|
- if (Error_Succeed != upError) {
|
|
|
- Dbg("get Upgraded path error");
|
|
|
- return FALSE;
|
|
|
- }
|
|
|
-
|
|
|
+ //删除rvc/Upgraded目录下的文件
|
|
|
DIR* updp;
|
|
|
struct dirent* updirp;
|
|
|
if ((updp = opendir(upPath.GetData())) != NULL) {
|
|
@@ -2699,156 +2704,19 @@ BOOL ResourceWatcherFSM::DeleteVersionPackage()
|
|
|
char szPath[MAX_VERSION_PATH] = { 0 };
|
|
|
strcat(szPath, upPath.GetData());
|
|
|
CSimpleStringA tmpDirPath = szPath;
|
|
|
- strcat(szPath, "/");
|
|
|
+ strcat(szPath, SPLIT_SLASH_STR);
|
|
|
strcat(szPath, updirp->d_name);
|
|
|
- Dbg("operating Upgrade path: [%s][%s]", (LPCTSTR)tmpDirPath, szPath);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("operating Upgrade path: [%s][%s]", (LPCTSTR)tmpDirPath, szPath);
|
|
|
RemoveFileA(szPath);
|
|
|
}
|
|
|
closedir(updp);
|
|
|
}
|
|
|
|
|
|
- int verSaved = DEFAULT_VERSION_SAVED_COUNT;
|
|
|
- int tmpSaved = 0;
|
|
|
- CSmartPointer<IEntityFunction> spFunction = this->GetEntityBase()->GetFunction();
|
|
|
- CSmartPointer<IConfigInfo> spConfig;
|
|
|
- spFunction->OpenConfig(Config_Software, spConfig);
|
|
|
- spConfig->ReadConfigValueInt("VersionSaved", "default", tmpSaved);
|
|
|
- if (tmpSaved > DEFAULT_VERSION_SAVED_COUNT)
|
|
|
- {
|
|
|
- verSaved = tmpSaved;
|
|
|
- }
|
|
|
-
|
|
|
- int nPackCount = intallInfoVects.size();
|
|
|
- Dbg("Install Package's count: %d", nPackCount);
|
|
|
- bool bFailFlag = false;
|
|
|
- int nDelVersionCnt = 0;
|
|
|
- if (nPackCount != 0) {
|
|
|
- int nSavedCount = 0;
|
|
|
- sort(intallInfoVects.begin(), intallInfoVects.end());
|
|
|
- //vector<CInstallInfoEx>::iterator iter = intallInfoVects.begin();
|
|
|
- vector<CVersion>::reverse_iterator riter = intallInfoVects.rbegin();
|
|
|
- while (riter != intallInfoVects.rend()) {
|
|
|
- //Dbg("InstallPackage Info: %s, SwithOverDate: %s", (LPCTSTR)iter->InstallVersion.ToString(), (LPCTSTR)iter->tmSwithOverDate.ToTimeString());
|
|
|
- Dbg("InstallPackage Info: %s", (LPCTSTR)(*riter).ToString());
|
|
|
- if (++nSavedCount <= verSaved) {
|
|
|
- Dbg("Save above version");
|
|
|
- riter++;
|
|
|
- continue;
|
|
|
- }
|
|
|
- //if (!DeleteSpecificeVersionDir(iter->InstallVersion))
|
|
|
- if (!DeleteSpecificeVersionDir(*riter))
|
|
|
- bFailFlag = true;
|
|
|
- else
|
|
|
- nDelVersionCnt++;
|
|
|
-
|
|
|
- riter++;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- nLstFlag = bFailFlag ? 1 : 0;
|
|
|
- spConfigRun->WriteConfigValueHexInt("VersionClear", "OptVer", info.InstallVersion.GetVersion64());
|
|
|
- spConfigRun->WriteConfigValueInt("VersionClear", "LastCondi", nLstFlag);
|
|
|
- spConfigRun->WriteConfigValue("VersionClear", "LastTime",
|
|
|
- (LPCTSTR)CSimpleStringA::Format("0x%08X", (DWORD)CSmallDateTime::GetNow()));
|
|
|
-
|
|
|
- string warn = "Delete Version files count : " + to_string(nDelVersionCnt);
|
|
|
- LogWarn(Severity_Low, Error_Debug, LOG_WARN_VER_DELETE, CSimpleStringA::Format("%s", warn.c_str()));
|
|
|
-
|
|
|
- return TRUE;
|
|
|
#else
|
|
|
- BOOL bRet = FALSE;
|
|
|
- ErrorCodeEnum erroCode = Error_Succeed;
|
|
|
- CSmartPointer<IEntityFunction> pFunc = GetEntityBase()->GetFunction();
|
|
|
- CSmartPointer<IConfigInfo> spConfigRun;
|
|
|
- CSystemStaticInfo& info = m_RvcSysinfo;
|
|
|
- erroCode = pFunc->GetSystemStaticInfo(info);
|
|
|
- if (erroCode != Error_Succeed)
|
|
|
- {
|
|
|
- LogWarn(Severity_Middle, erroCode, 0, "Get system static info error");
|
|
|
- return FALSE;
|
|
|
- }
|
|
|
-
|
|
|
- //判断是否需要被清理
|
|
|
- erroCode = pFunc->OpenConfig(Config_Run, spConfigRun);
|
|
|
- if (erroCode != Error_Succeed)
|
|
|
- {
|
|
|
- LogWarn(Severity_Middle, erroCode, 0, "Open Run Config failed");
|
|
|
- return FALSE;
|
|
|
- }
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Current version: %s", (LPCTSTR)info.InstallVersion.ToString());
|
|
|
-
|
|
|
- int nLastTaskTime = 0;
|
|
|
- int nLstFlag = 0;
|
|
|
- int nDelCount = 0;
|
|
|
- UINT64 utVersion = 0;
|
|
|
-
|
|
|
- spConfigRun->ReadConfigValueHexInt("VersionClear", "OptVer", utVersion);
|
|
|
- spConfigRun->ReadConfigValueInt("VersionClear", "DelVerCnt", nDelCount);
|
|
|
- spConfigRun->ReadConfigValueInt("VersionClear", "LastCondi", nLstFlag);
|
|
|
- spConfigRun->ReadConfigValueInt("VersionClear", "LastTime", nLastTaskTime);
|
|
|
-
|
|
|
- CVersion optVer(utVersion);
|
|
|
- SYSTEMTIME stTaskTime = CSmallDateTime(nLastTaskTime).ToSystemTime();
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("LastTime<%04d-%02d-%02d %02d:%02d:%02d>: OptVer: %s, LastCondi: %d",
|
|
|
- stTaskTime.wYear, stTaskTime.wMonth, stTaskTime.wDay,
|
|
|
- stTaskTime.wHour, stTaskTime.wMinute, stTaskTime.wSecond,
|
|
|
- (LPCTSTR)optVer.ToString(), nLstFlag);
|
|
|
- SYSTEMTIME stNow = {};
|
|
|
- GetLocalTime(&stNow);
|
|
|
- if (optVer.IsValid() && optVer == info.InstallVersion && !nLstFlag)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("VersionPackage cleaning has been done before.");
|
|
|
- return TRUE;
|
|
|
- }
|
|
|
-
|
|
|
- CSimpleStringA strRunInfo, strStartTime;
|
|
|
- if (m_pEntity->GetFunction()->GetPath("RunInfo", strRunInfo) == Error_Succeed) {
|
|
|
- strStartTime = strRunInfo + "\\runcfg\\starttime.dat";
|
|
|
- if (!ExistsFileA(strStartTime.GetData())) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("upgrade prpcess done, try to delete version files.");//完成升级过程,通过
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("upgrade process is not end ,should not delete version files.");
|
|
|
- return FALSE;//升级未完成,不进行删除
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("upgrade process is not end ,get runinfo path is error, should not delete version files.");
|
|
|
- return FALSE;//失败,继续等待
|
|
|
- }
|
|
|
-
|
|
|
- //获取当前目录下的文件夹名称, 将符合命名规则的终端版本名称push_back
|
|
|
- CSimpleStringA csPath;
|
|
|
- ErrorCodeEnum Error = m_pEntity->GetFunction()->GetPath("RootVer", csPath); //获取当前版本路劲 例如:C:\Run
|
|
|
- if (Error_Succeed == Error) {
|
|
|
- if (csPath.IsNullOrEmpty())
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("get currVer path is null");
|
|
|
- return FALSE;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //csPath.Append("\\version");
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("CUR VERSION PATH = %s.", csPath.GetData());
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("get Ver path error");
|
|
|
- return FALSE;
|
|
|
- }
|
|
|
-
|
|
|
- //vector<CInstallInfoEx> intallInfoVects;
|
|
|
- vector<CVersion> intallInfoVects;
|
|
|
- vector<string> files;
|
|
|
long hFile = 0;
|
|
|
struct _finddata_t fileinfo;//文件信息读取结构
|
|
|
string p;
|
|
|
|
|
|
- /*CSimpleStringA uiState;
|
|
|
- m_pEntity->GetFunction()->GetSysVar("UIState", uiState);*/
|
|
|
-
|
|
|
-
|
|
|
if ((hFile = _findfirst(p.assign(string(csPath.GetData())).append("\\*").c_str(), &fileinfo)) != -1) {
|
|
|
do {
|
|
|
CInstallInfo verInfo = {};
|
|
@@ -2863,7 +2731,6 @@ BOOL ResourceWatcherFSM::DeleteVersionPackage()
|
|
|
CVersion verName(dwMajor, dwMinor, dwRevision, dwBuild);
|
|
|
if (verName.IsValid() && verName < info.InstallVersion)
|
|
|
{
|
|
|
- //verInfo.InstallVersion = verName;
|
|
|
intallInfoVects.push_back(verName);
|
|
|
}
|
|
|
else {
|
|
@@ -2874,14 +2741,6 @@ BOOL ResourceWatcherFSM::DeleteVersionPackage()
|
|
|
_findclose(hFile);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- CSimpleStringA upPath;
|
|
|
- ErrorCodeEnum upError = m_pEntity->GetFunction()->GetPath("Upgraded", upPath);
|
|
|
- if (Error_Succeed != upError) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("get Upgraded path error");
|
|
|
- return FALSE;
|
|
|
- }
|
|
|
-
|
|
|
//删除rvc/Upgraded目录下的文件
|
|
|
struct _finddata_t upfileinfo;
|
|
|
long upFile = 0;
|
|
@@ -2891,7 +2750,7 @@ BOOL ResourceWatcherFSM::DeleteVersionPackage()
|
|
|
char szPath[MAX_VERSION_PATH] = { 0 };
|
|
|
strcat_s(szPath, upPath.GetData());
|
|
|
CSimpleStringA tmpDirPath = szPath;
|
|
|
- strcat_s(szPath, "\\");
|
|
|
+ strcat_s(szPath, SPLIT_SLASH_STR);
|
|
|
strcat_s(szPath, upfileinfo.name);
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("operating Upgrade path: [%s][%s]", (LPCTSTR)tmpDirPath, szPath);
|
|
|
RemoveFileA(szPath);
|
|
@@ -2899,64 +2758,47 @@ BOOL ResourceWatcherFSM::DeleteVersionPackage()
|
|
|
_findclose(upFile);
|
|
|
}
|
|
|
|
|
|
- int verSaved = DEFAULT_VERSION_SAVED_COUNT;
|
|
|
- int tmpSaved = 0;
|
|
|
- CSmartPointer<IEntityFunction> spFunction = this->GetEntityBase()->GetFunction();
|
|
|
- CSmartPointer<IConfigInfo> spConfig;
|
|
|
- spFunction->OpenConfig(Config_CenterSetting, spConfig); //迁移至集中配置下
|
|
|
- spConfig->ReadConfigValueInt("ResourceWatcher", "VersionSaved", tmpSaved);
|
|
|
-
|
|
|
- if (tmpSaved > DEFAULT_VERSION_SAVED_COUNT)
|
|
|
- {
|
|
|
- verSaved = tmpSaved;
|
|
|
- }
|
|
|
+#endif // RVC_OS_LINUX
|
|
|
|
|
|
- int nPackCount = intallInfoVects.size();
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Install Package's count: %d", nPackCount);
|
|
|
- bool bFailFlag = false;
|
|
|
- int nDelVersionCnt = 0;
|
|
|
- std::string tInfo("");
|
|
|
+ int nPackCount = intallInfoVects.size();
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Install Package's count: %d", nPackCount);
|
|
|
+ bool bFailFlag = false;
|
|
|
+ int nDelVersionCnt = 0;
|
|
|
+ std::string tInfo("");
|
|
|
|
|
|
- if (nPackCount != 0)
|
|
|
- {
|
|
|
- int nSavedCount = 0;
|
|
|
- sort(intallInfoVects.begin(), intallInfoVects.end());
|
|
|
- //vector<CInstallInfoEx>::iterator iter = intallInfoVects.begin();
|
|
|
- vector<CVersion>::reverse_iterator riter = intallInfoVects.rbegin();
|
|
|
- while (riter != intallInfoVects.rend())
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("InstallPackage Info: %s", (LPCTSTR)(*riter).ToString());
|
|
|
- if (++nSavedCount <= verSaved)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Save above version");
|
|
|
- riter++;
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (!DeleteSpecificeVersionDir(*riter)) bFailFlag = true;
|
|
|
- else
|
|
|
- {
|
|
|
- nDelVersionCnt++;
|
|
|
- tInfo = tInfo + "|" + std::string((*riter).ToString().GetData());
|
|
|
- }
|
|
|
- riter++;
|
|
|
- }
|
|
|
- }
|
|
|
+ if (nPackCount != 0) {
|
|
|
+ int nSavedCount = 0;
|
|
|
+ sort(intallInfoVects.begin(), intallInfoVects.end());
|
|
|
+ vector<CVersion>::reverse_iterator riter = intallInfoVects.rbegin();
|
|
|
+ while (riter != intallInfoVects.rend()) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("InstallPackage Info: %s", (LPCTSTR)(*riter).ToString());
|
|
|
+ if (++nSavedCount <= verSaved) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Save above version");
|
|
|
+ riter++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!DeleteSpecificeVersionDir(*riter)) bFailFlag = true;
|
|
|
+ else {
|
|
|
+ nDelVersionCnt++;
|
|
|
+ tInfo = tInfo + "|" + std::string((*riter).ToString().GetData());
|
|
|
+ }
|
|
|
+ riter++;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- nLstFlag = bFailFlag ? 1 : 0;
|
|
|
- spConfigRun->WriteConfigValueHexInt("VersionClear", "OptVer", info.InstallVersion.GetVersion64());
|
|
|
- spConfigRun->WriteConfigValueInt("VersionClear", "DelVerCnt", nDelCount + nDelVersionCnt);
|
|
|
- spConfigRun->WriteConfigValueInt("VersionClear", "LastCondi", nLstFlag);
|
|
|
- spConfigRun->WriteConfigValue("VersionClear", "LastTime",
|
|
|
- (LPCTSTR)CSimpleStringA::Format("0x%08X", (DWORD)CSmallDateTime::GetNow()));
|
|
|
+ nLstFlag = bFailFlag ? 1 : 0;
|
|
|
+ spConfigRun->WriteConfigValueHexInt("VersionClear", "OptVer", info.InstallVersion.GetVersion64());
|
|
|
+ spConfigRun->WriteConfigValueInt("VersionClear", "DelVerCnt", nDelCount + nDelVersionCnt);
|
|
|
+ spConfigRun->WriteConfigValueInt("VersionClear", "LastCondi", nLstFlag);
|
|
|
+ spConfigRun->WriteConfigValue("VersionClear", "LastTime",
|
|
|
+ (LPCTSTR)CSimpleStringA::Format("0x%08X", (DWORD)CSmallDateTime::GetNow()));
|
|
|
|
|
|
- if (nDelVersionCnt > 0)
|
|
|
- {
|
|
|
- std::string warn = "Delete Vesion file count : " + std::to_string((long long)nDelVersionCnt) + ". ----- " + tInfo + ".";
|
|
|
- LogWarn(Severity_Low, Error_Debug, LOG_WARN_VER_DELETE, CSimpleStringA::Format("%s", warn.c_str()));
|
|
|
- }
|
|
|
+ if (nDelVersionCnt > 0) {
|
|
|
+ std::string warn = "Delete Vesion file count : " + std::to_string((long long)nDelVersionCnt) + ". ----- " + tInfo + ".";
|
|
|
+ LogWarn(Severity_Low, Error_Debug, LOG_WARN_VER_DELETE, CSimpleStringA::Format("%s", warn.c_str()));
|
|
|
+ }
|
|
|
|
|
|
- return TRUE;
|
|
|
-#endif // RVC_OS_LINUX
|
|
|
+ return TRUE;
|
|
|
}
|
|
|
|
|
|
BOOL ResourceWatcherFSM::DeleteSpecificeVersionDir(CVersion version)
|