浏览代码

Z991239-5470 #comment feat: 同步文件删除失败的rta

陈纪林80310970 1 年之前
父节点
当前提交
033eb93407
共有 2 个文件被更改,包括 14 次插入12 次删除
  1. 12 10
      Module/mod_ResourceWatcher/ResourceWatcherFSM.cpp
  2. 2 2
      Module/mod_ResourceWatcher/ResourceWatcher_UserCode.h

+ 12 - 10
Module/mod_ResourceWatcher/ResourceWatcherFSM.cpp

@@ -562,11 +562,7 @@ void ResourceWatcherFSM::CenterSettingDelete()
 
     if (!bFailFlag) 
     {
-        LogWarn(Severity_Low, Error_Debug, LOG_WARN_DIR_DELETE_SUC, CSimpleStringA::Format("Delete files in [%s] success", tempPath.GetData()));
-    }
-    else
-    {
-        LogWarn(Severity_Low, Error_Debug, LOG_WARN_DIR_DELETE_FAILED, CSimpleStringA::Format("Delete files in [%s] failed", tempPath.GetData()));
+        LogWarn(Severity_Low, Error_Debug, LOG_WARN_FILE_DELETE_SUC, CSimpleStringA::Format("Delete files in [%s] success", tempPath.GetData()));
     }
 }
 
@@ -667,7 +663,8 @@ int ResourceWatcherFSM::ProcessFileDelete(LPCTSTR lpszPath, int& nDelSucCnt, int
         }
         else {
             nDelFailedCnt++;
-            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("RemoveFileA [%s] failed, GLE = %u.", tempFilePath, errno);
+            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA5A08").setAPI("DeleteFiles")("RemoveFileA [%s] failed, GLE = %u.", tempFilePath, errno);
+            LogWarn(Severity_Middle, Error_Debug, LOG_WARN_FILE_DELETE_FAILED, CSimpleStringA::Format("RemoveFileA [%s] failed, GLE = %u.", tempFilePath, errno));
         }
         if (searchFilePath) delete[] searchFilePath;
         if (tempFilePath) delete[] tempFilePath;
@@ -720,7 +717,8 @@ int ResourceWatcherFSM::ProcessFileDelete(LPCTSTR lpszPath, int& nDelSucCnt, int
         int tDelSucCnt = 0, tDelFailedCnt = 0;
         fileCnt += ProcessFileDelete((LPCTSTR)tempFilePath, tDelSucCnt, tDelFailedCnt, true); //子目录要清理
         if (tDelFailedCnt != 0) {
-            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("rm(%s) failed, GLE = %u.", (LPCTSTR)tempFilePath, errno);
+            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA5A08").setAPI("DeleteFiles")("rm(%s) failed, GLE = %u.", (LPCTSTR)tempFilePath, errno);
+            LogWarn(Severity_Middle, Error_Debug, LOG_WARN_FILE_DELETE_FAILED, CSimpleStringA::Format("rm(%s) failed, GLE = %u.", (LPCTSTR)tempFilePath, errno));
             nDelSucCnt += tDelSucCnt;
             nDelFailedCnt += tDelFailedCnt;
             return fileCnt;
@@ -765,7 +763,9 @@ int ResourceWatcherFSM::ProcessFileDelete(LPCTSTR lpszPath, int& nDelSucCnt, int
         else
         {
             nDelFailedCnt++;
-            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Delete [%s] failed, GLE = %u.", lpszPath, GetLastError());
+            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA5A08").setAPI("DeleteFiles")
+                ("Delete [%s] failed, GLE = %u.", lpszPath, GetLastError());
+            LogWarn(Severity_Middle, Error_Debug, LOG_WARN_FILE_DELETE_FAILED, CSimpleStringA::Format("RemoveFileA [%s] failed, GLE = %u.", lpszPath, errno));
         }
         if (searchFilePath) delete[] searchFilePath;
         if (tempFilePath) delete[] tempFilePath;
@@ -814,7 +814,9 @@ int ResourceWatcherFSM::ProcessFileDelete(LPCTSTR lpszPath, int& nDelSucCnt, int
                 fileCnt += ProcessFileDelete((LPCTSTR)tempFilePath, tDelSucCnt, tDelFailedCnt, true); //子目录要删除
                 if (tDelFailedCnt != 0)
                 {
-                    DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("rm(%s) failed, GLE = %u.", (LPCTSTR)tempFilePath, GetLastError());
+                    DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA5A08").setAPI("DeleteFiles")
+                        ("rm(%s) failed, GLE = %u.", (LPCTSTR)tempFilePath, GetLastError());
+                    LogWarn(Severity_Middle, Error_Debug, LOG_WARN_FILE_DELETE_FAILED, CSimpleStringA::Format("RemoveFileA [%s] failed, GLE = %u.", (LPCTSTR)tempFilePath, errno));
                     nDelFailedCnt += tDelFailedCnt;
                     return fileCnt;
                 }
@@ -2760,7 +2762,7 @@ void ResourceWatcherFSM::CheckDiskFileSpace()
             {
                 fileLen = fileinfo.size;
             }
-
+            
 
             CSimpleStringA resLen = CSimpleStringA::Format("%lld B", fileLen);
             if (fileLen >= 1024 && fileLen < (1024 * 1024))

+ 2 - 2
Module/mod_ResourceWatcher/ResourceWatcher_UserCode.h

@@ -63,11 +63,11 @@
 #define LOG_WARN_GET_FILE_CONTENT 0x50A00050
 #define LOG_WARN_READ_FILE_INFO 0x50A00051
 #define LOG_WARN_PROCESS_STATUS 0x50A00052
-#define LOG_WARN_DIR_DELETE_SUC	0x50A00053
+#define LOG_WARN_FILE_DELETE_SUC 0x50A00053
 #define LOG_WARN_ACTIVE_FILE_CHANGE	0x50A00054
 #define LOG_INFO_DESKTOP_FILESTATUS	0x50A00055
 #define LOG_INFO_INSTALL_BY_SETUP	0x50A00056
-#define LOG_WARN_DIR_DELETE_FAILED	0x50A00057
+#define LOG_WARN_FILE_DELETE_FAILED	0x50A00057
 
 #define LOG_RESOURCEWATCHER_OSD_RECOVER_ENABLE 0x50A00060
 #define LOG_RESOURCEWATCHER_OSD_REMOVE_SUCC 0x50A00061