解决websdk无法保存缓存图像的问题
This commit is contained in:
parent
fbcec26fea
commit
07009e121e
|
@ -106,10 +106,6 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent)
|
||||||
m_versionDll = new VersionDll;
|
m_versionDll = new VersionDll;
|
||||||
HGBase_RegisterCrashFunc(CrashFunc, this);
|
HGBase_RegisterCrashFunc(CrashFunc, this);
|
||||||
|
|
||||||
HGChar logFilePath[512];
|
|
||||||
HGBase_GetLogFilePath(logFilePath, 512);
|
|
||||||
deleteOverdueLogFile(QString::fromStdString(getStdString(logFilePath)));
|
|
||||||
|
|
||||||
HGChar cfgFilePath[512];
|
HGChar cfgFilePath[512];
|
||||||
HGBase_GetConfigPath(cfgFilePath, 512);
|
HGBase_GetConfigPath(cfgFilePath, 512);
|
||||||
deleteUpgradePkg(QString::fromStdString(getStdString(cfgFilePath)));
|
deleteUpgradePkg(QString::fromStdString(getStdString(cfgFilePath)));
|
||||||
|
@ -2987,7 +2983,7 @@ void HGAPI MainWindow::CrashFunc(HGPointer crashAddr, HGPointer param)
|
||||||
|
|
||||||
|
|
||||||
HGChar crashName[256];
|
HGChar crashName[256];
|
||||||
HGBase_GetLogFilePath(crashName, 256);
|
HGBase_GetConfigPath(crashName, 256);
|
||||||
strcat(crashName, "crash.dmp");
|
strcat(crashName, "crash.dmp");
|
||||||
if (HGBASE_ERR_OK == HGBase_MakeCrashFile(crashName))
|
if (HGBASE_ERR_OK == HGBase_MakeCrashFile(crashName))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1225,7 +1225,7 @@ void MainWindow::ocrMsgPumpFunc(HGMsgPump msgPump, const HGMsg *msg, HGPointer p
|
||||||
void MainWindow::CrashFunc(HGPointer crashAddr, HGPointer param)
|
void MainWindow::CrashFunc(HGPointer crashAddr, HGPointer param)
|
||||||
{
|
{
|
||||||
HGChar crashName[256];
|
HGChar crashName[256];
|
||||||
HGBase_GetLogFilePath(crashName, 256);
|
HGBase_GetConfigPath(crashName, 256);
|
||||||
strcat(crashName, "crash.dmp");
|
strcat(crashName, "crash.dmp");
|
||||||
if (HGBASE_ERR_OK == HGBase_MakeCrashFile(crashName))
|
if (HGBASE_ERR_OK == HGBase_MakeCrashFile(crashName))
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,7 +56,7 @@ HGBase_GetModuleName
|
||||||
HGBase_GetUuid
|
HGBase_GetUuid
|
||||||
HGBase_GetTmpFileName
|
HGBase_GetTmpFileName
|
||||||
HGBase_GetConfigPath
|
HGBase_GetConfigPath
|
||||||
HGBase_GetLogFilePath
|
HGBase_GetCacheFilePath
|
||||||
HGBase_GetDocumentsPath
|
HGBase_GetDocumentsPath
|
||||||
HGBase_GetProcessName
|
HGBase_GetProcessName
|
||||||
HGBase_GetFilePath
|
HGBase_GetFilePath
|
||||||
|
|
|
@ -273,32 +273,6 @@ HGResult HGAPI HGBase_GetConfigPath(HGChar* configPath, HGUInt maxLen)
|
||||||
return HGBASE_ERR_INVALIDARG;
|
return HGBASE_ERR_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
HGChar moduleName[256];
|
|
||||||
HGBase_GetModuleName(NULL, moduleName, 256);
|
|
||||||
HGChar modulePath[256];
|
|
||||||
HGBase_GetFilePath(moduleName, modulePath, 256);
|
|
||||||
strcat(modulePath, "first.cfg");
|
|
||||||
|
|
||||||
HGChar dataPath[256] = {0};
|
|
||||||
HGBase_GetProfileString(modulePath, "constraints", "local_data_path", "", dataPath, 256);
|
|
||||||
if ('\0' != *dataPath)
|
|
||||||
{
|
|
||||||
#if defined(HG_CMP_MSC)
|
|
||||||
if (dataPath[strlen(dataPath) - 1] != '\\')
|
|
||||||
strcat(dataPath, "\\");
|
|
||||||
strcat(dataPath, "Cfg\\");
|
|
||||||
#else
|
|
||||||
if (dataPath[strlen(dataPath) - 1] != '/')
|
|
||||||
strcat(dataPath, "/");
|
|
||||||
strcat(dataPath, "Cfg/");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (maxLen < strlen(dataPath) + 1)
|
|
||||||
return HGBASE_ERR_FAIL;
|
|
||||||
strcpy(configPath, dataPath);
|
|
||||||
return HGBASE_ERR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(HG_CMP_MSC)
|
#if defined(HG_CMP_MSC)
|
||||||
CHAR cfgPath[MAX_PATH] = { 0 };
|
CHAR cfgPath[MAX_PATH] = { 0 };
|
||||||
BOOL ret = SHGetSpecialFolderPathA(NULL, cfgPath, CSIDL_APPDATA, FALSE);
|
BOOL ret = SHGetSpecialFolderPathA(NULL, cfgPath, CSIDL_APPDATA, FALSE);
|
||||||
|
@ -331,68 +305,42 @@ HGResult HGAPI HGBase_GetConfigPath(HGChar* configPath, HGUInt maxLen)
|
||||||
return HGBASE_ERR_OK;
|
return HGBASE_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HGResult HGAPI HGBase_GetLogFilePath(HGChar* logFilePath, HGUInt maxLen)
|
HGResult HGAPI HGBase_GetCacheFilePath(HGChar* cacheFilePath, HGUInt maxLen)
|
||||||
{
|
{
|
||||||
if (NULL == logFilePath || 0 == maxLen)
|
if (NULL == cacheFilePath || 0 == maxLen)
|
||||||
{
|
{
|
||||||
return HGBASE_ERR_INVALIDARG;
|
return HGBASE_ERR_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
HGChar moduleName[256];
|
|
||||||
HGBase_GetModuleName(NULL, moduleName, 256);
|
|
||||||
HGChar modulePath[256];
|
|
||||||
HGBase_GetFilePath(moduleName, modulePath, 256);
|
|
||||||
strcat(modulePath, "first.cfg");
|
|
||||||
|
|
||||||
HGChar dataPath[256] = { 0 };
|
|
||||||
HGBase_GetProfileString(modulePath, "constraints", "local_data_path", "", dataPath, 256);
|
|
||||||
if ('\0' != *dataPath)
|
|
||||||
{
|
|
||||||
#if defined(HG_CMP_MSC)
|
#if defined(HG_CMP_MSC)
|
||||||
if (dataPath[strlen(dataPath) - 1] != '\\')
|
CHAR cachePath[MAX_PATH] = { 0 };
|
||||||
strcat(dataPath, "\\");
|
BOOL ret = SHGetSpecialFolderPathA(NULL, cachePath, CSIDL_APPDATA, FALSE);
|
||||||
strcat(dataPath, "Cfg\\");
|
|
||||||
#else
|
|
||||||
if (dataPath[strlen(dataPath) - 1] != '/')
|
|
||||||
strcat(dataPath, "/");
|
|
||||||
strcat(dataPath, "Cfg/");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (maxLen < strlen(dataPath) + 1)
|
|
||||||
return HGBASE_ERR_FAIL;
|
|
||||||
strcpy(logFilePath, dataPath);
|
|
||||||
return HGBASE_ERR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(HG_CMP_MSC)
|
|
||||||
CHAR logPath[MAX_PATH] = { 0 };
|
|
||||||
BOOL ret = SHGetSpecialFolderPathA(NULL, logPath, CSIDL_APPDATA, FALSE);
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return HGBASE_ERR_FAIL;
|
return HGBASE_ERR_FAIL;
|
||||||
if (logPath[strlen(logPath) - 1] != '\\')
|
if (cachePath[strlen(cachePath) - 1] != '\\')
|
||||||
strcat(logPath, "\\");
|
strcat(cachePath, "\\");
|
||||||
|
|
||||||
HGChar procName[64];
|
HGChar procName[64];
|
||||||
HGBase_GetProcessName(procName, 64);
|
HGBase_GetProcessName(procName, 64);
|
||||||
strcat(logPath, procName);
|
strcat(cachePath, procName);
|
||||||
strcat(logPath, "\\Log\\");
|
strcat(cachePath, "\\Cache\\");
|
||||||
#else
|
#else
|
||||||
char logPath[512] = { 0 };
|
char cachePath[512] = { 0 };
|
||||||
struct passwd* pw = getpwuid(getuid());
|
struct passwd* pw = getpwuid(getuid());
|
||||||
strcpy(logPath, pw->pw_dir);
|
strcpy(cachePath, pw->pw_dir);
|
||||||
if (logPath[strlen(logPath) - 1] != '/')
|
if (cachePath[strlen(cachePath) - 1] != '/')
|
||||||
strcat(logPath, "/");
|
strcat(cachePath, "/");
|
||||||
|
|
||||||
strcat(logPath, ".");
|
strcat(cachePath, ".");
|
||||||
HGChar procName[64];
|
HGChar procName[64];
|
||||||
HGBase_GetProcessName(procName, 64);
|
HGBase_GetProcessName(procName, 64);
|
||||||
strcat(logPath, procName);
|
strcat(cachePath, procName);
|
||||||
strcat(logPath, "/Log/");
|
strcat(cachePath, "/Cache/");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (maxLen < strlen(logPath) + 1)
|
if (maxLen < strlen(cachePath) + 1)
|
||||||
return HGBASE_ERR_FAIL;
|
return HGBASE_ERR_FAIL;
|
||||||
strcpy(logFilePath, logPath);
|
strcpy(cacheFilePath, cachePath);
|
||||||
return HGBASE_ERR_OK;
|
return HGBASE_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,9 @@ HGEXPORT HGResult HGAPI HGBase_GetTmpFileName(const HGChar *suffix, HGChar* file
|
||||||
*/
|
*/
|
||||||
HGEXPORT HGResult HGAPI HGBase_GetConfigPath(HGChar* configPath, HGUInt maxLen);
|
HGEXPORT HGResult HGAPI HGBase_GetConfigPath(HGChar* configPath, HGUInt maxLen);
|
||||||
|
|
||||||
/* 获取日志文件路径
|
/* 获取缓存文件路径
|
||||||
*/
|
*/
|
||||||
HGEXPORT HGResult HGAPI HGBase_GetLogFilePath(HGChar* logFilePath, HGUInt maxLen);
|
HGEXPORT HGResult HGAPI HGBase_GetCacheFilePath(HGChar* cacheFilePath, HGUInt maxLen);
|
||||||
|
|
||||||
/* 获取文档路径
|
/* 获取文档路径
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1388,12 +1388,10 @@ namespace ver_1
|
||||||
std::string ManagerV1::GetFilePath(const std::string& devId)
|
std::string ManagerV1::GetFilePath(const std::string& devId)
|
||||||
{
|
{
|
||||||
HGChar docsPath[256];
|
HGChar docsPath[256];
|
||||||
HGBase_GetDocumentsPath(docsPath, 256);
|
HGBase_GetCacheFilePath(docsPath, 256);
|
||||||
HGChar procName[256];
|
|
||||||
HGBase_GetProcessName(procName, 256);
|
|
||||||
|
|
||||||
HGChar imgPath[512];
|
HGChar imgPath[512];
|
||||||
sprintf(imgPath, "%s%s/%s/", docsPath, procName, Utf8ToStdString(devId).c_str());
|
sprintf(imgPath, "%s%s/", docsPath, Utf8ToStdString(devId).c_str());
|
||||||
HGChar stdImgPath[512];
|
HGChar stdImgPath[512];
|
||||||
HGBase_StandardiseFileName(imgPath, stdImgPath, 512);
|
HGBase_StandardiseFileName(imgPath, stdImgPath, 512);
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,8 @@ namespace ver_2
|
||||||
m_lock = NULL;
|
m_lock = NULL;
|
||||||
HGBase_CreateLock(&m_lock);
|
HGBase_CreateLock(&m_lock);
|
||||||
|
|
||||||
HGChar docsPath[256];
|
|
||||||
HGBase_GetDocumentsPath(docsPath, 256);
|
|
||||||
HGChar procName[256];
|
|
||||||
HGBase_GetProcessName(procName, 256);
|
|
||||||
HGChar defSavePath[256];
|
HGChar defSavePath[256];
|
||||||
sprintf(defSavePath, "%s%s/", docsPath, procName);
|
HGBase_GetCacheFilePath(defSavePath, 256);
|
||||||
|
|
||||||
m_globalCfg.fileSavePath = GetCfgStringValue("global", "fileSavePath", defSavePath);
|
m_globalCfg.fileSavePath = GetCfgStringValue("global", "fileSavePath", defSavePath);
|
||||||
m_globalCfg.fileNamePrefix = GetCfgStringValue("global", "fileNamePrefix", "");
|
m_globalCfg.fileNamePrefix = GetCfgStringValue("global", "fileNamePrefix", "");
|
||||||
|
|
|
@ -43,7 +43,7 @@ HGMsgPump msgPumpV2 = NULL;
|
||||||
static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param)
|
static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param)
|
||||||
{
|
{
|
||||||
HGChar logPath[256];
|
HGChar logPath[256];
|
||||||
HGBase_GetLogFilePath(logPath, 256);
|
HGBase_GetConfigPath(logPath, 256);
|
||||||
strcat(logPath, "crash.dmp");
|
strcat(logPath, "crash.dmp");
|
||||||
HGBase_MakeCrashFile(logPath);
|
HGBase_MakeCrashFile(logPath);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue