|
|
@@ -3,6 +3,7 @@
|
|
|
#include <EventCode.h>
|
|
|
#include "GUIConsole_msg_g.h"
|
|
|
#include <chrono>
|
|
|
+#include <fstream>
|
|
|
|
|
|
|
|
|
|
|
|
@@ -406,7 +407,7 @@ std::pair<DWORD, std::string> CGUIConsoleEntity::VTM_controlEntity(SpReqAnsConte
|
|
|
{
|
|
|
auto control_thread = [this](SpReqAnsContext<GUIConsoleService_VTM_controlEntity_Req, GUIConsoleService_VTM_controlEntity_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- ErrorCodeEnum ret = ErrorCodeEnum::Error_Succeed;
|
|
|
+ int ret = ErrorCodeEnum::Error_Succeed;
|
|
|
if (!ctx->Req.operation.Compare("Start", true))
|
|
|
ret = sync_StartEntity(ctx->Req.entityName, NULL, NULL);
|
|
|
else if (!ctx->Req.operation.Compare("Stop", true))
|
|
|
@@ -877,7 +878,7 @@ ErrorCodeEnum CGUIConsoleEntity::AsyncTerminateEntity(const char* entity_name, v
|
|
|
|
|
|
#define MAX_SYNC_TIMEOUT 20000
|
|
|
|
|
|
-ErrorCodeEnum CGUIConsoleEntity::sync_StartEntity(const char* entity_name, const char* cmdline, void* pData)
|
|
|
+int CGUIConsoleEntity::sync_StartEntity(const char* entity_name, const char* cmdline, void* pData)
|
|
|
{
|
|
|
CSmartPointer<IEntityFunction> pFunc = GetFunction();
|
|
|
CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
|
|
|
@@ -893,7 +894,7 @@ ErrorCodeEnum CGUIConsoleEntity::sync_StartEntity(const char* entity_name, const
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-ErrorCodeEnum CGUIConsoleEntity::sync_StopEntity(const char* entity_name, void* pData)
|
|
|
+int CGUIConsoleEntity::sync_StopEntity(const char* entity_name, void* pData)
|
|
|
{
|
|
|
CSmartPointer<IEntityFunction> pFunc = GetFunction();
|
|
|
CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
|
|
|
@@ -909,7 +910,7 @@ ErrorCodeEnum CGUIConsoleEntity::sync_StopEntity(const char* entity_name, void*
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-ErrorCodeEnum CGUIConsoleEntity::sync_PauseEntity(const char* entity_name, void* pData)
|
|
|
+int CGUIConsoleEntity::sync_PauseEntity(const char* entity_name, void* pData)
|
|
|
{
|
|
|
CSmartPointer<IEntityFunction> pFunc = GetFunction();
|
|
|
CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
|
|
|
@@ -925,7 +926,7 @@ ErrorCodeEnum CGUIConsoleEntity::sync_PauseEntity(const char* entity_name, void*
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-ErrorCodeEnum CGUIConsoleEntity::sync_ContinueEntity(const char* entity_name, void* pData)
|
|
|
+int CGUIConsoleEntity::sync_ContinueEntity(const char* entity_name, void* pData)
|
|
|
{
|
|
|
CSmartPointer<IEntityFunction> pFunc = GetFunction();
|
|
|
CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
|
|
|
@@ -941,7 +942,7 @@ ErrorCodeEnum CGUIConsoleEntity::sync_ContinueEntity(const char* entity_name, vo
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-ErrorCodeEnum CGUIConsoleEntity::sync_TerminateEntity(const char* entity_name, void* pData)
|
|
|
+int CGUIConsoleEntity::sync_TerminateEntity(const char* entity_name, void* pData)
|
|
|
{
|
|
|
CSmartPointer<IEntityFunction> pFunc = GetFunction();
|
|
|
CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
|
|
|
@@ -957,13 +958,35 @@ ErrorCodeEnum CGUIConsoleEntity::sync_TerminateEntity(const char* entity_name, v
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-ErrorCodeEnum CGUIConsoleEntity::sync_OpenLog(const char* entity_name, void* pData)
|
|
|
+int CGUIConsoleEntity::sync_OpenLog(const char* entity_name, void* pData)
|
|
|
{
|
|
|
+ auto fileExist = [](const char* path) ->bool {
|
|
|
+ fstream f2;
|
|
|
+ f2.open(path);
|
|
|
+ if (!f2)
|
|
|
+ {
|
|
|
+ f2.close();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ f2.close();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
ErrorCodeEnum ret = ErrorCodeEnum::Error_Succeed;
|
|
|
CEntityLogInfo cur;
|
|
|
if (ErrorCodeEnum::Error_Succeed != (ret = GetFunction()->GetEntityLogPath(entity_name, cur)))
|
|
|
return ret;
|
|
|
|
|
|
+ if(!fileExist(cur.strLogPath))
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("%s not exist", cur.strLogPath.GetData());
|
|
|
+ return WARN_GUICONSOLE_ENTITYCONTROL_LOG_NOTEXIST;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 使用记事本打开文件
|
|
|
#ifdef _WIN32
|
|
|
// Windows 上使用 ShellExecute 打开文件
|