Commit 10af7420 by xiaojing.zhang

reset client.xml

parent 6c2ee258
......@@ -23,6 +23,8 @@
#include "global.h"
#include "QsLog.h"
#include <QFile>
#define XML_FREEMUD_CLIENT "Client.xml"
//extern char XML_FREEMUD_CLIENT[256];
......@@ -1356,7 +1358,8 @@ public:
static bool JsonConvertFront(const Document &srcdoc, Document &desdoc, string &key, string &values, string &lasterror)
{
xml_document<> doc;
string posxml;
//string posxml;
string currPath;
stringstream error;
if (srcdoc.HasParseError() || desdoc.HasParseError() || srcdoc.IsNull())
......@@ -1369,19 +1372,24 @@ public:
if(desdoc.IsNull())
desdoc.Parse<0>("{}");
GetProcPath(posxml);
GetProcPath(currPath);
string realPath = currPath;
QString filename = Tool::ReadCfg(CFG_SECTION_XMLFILENAME, XML_FREEMUD_CLIENT).toString();
posxml.append(filename.toStdString());
realPath.append(filename.toStdString());
if(!QFile::exists(QString::fromStdString(realPath))) {
realPath = currPath + XML_FREEMUD_CLIENT;
}
QLOG_DEBUG() << "JsonConvertFront xml name :" << QString::fromStdString(posxml);
QLOG_DEBUG() << "JsonConvertFront xml name :" << QString::fromStdString(realPath);
#ifdef WIN32
if(_access(posxml.data(), 0) == -1)
if(_access(realPath.data(), 0) == -1)
#else
if(access(posxml.data(), F_OK) == -1)
if(access(realPath.data(), F_OK) == -1)
#endif
{
error << posxml << " not found";
error << realPath << " not found";
lasterror = error.str();
return false;
}
......@@ -1389,7 +1397,7 @@ public:
try
{
file<> fdoc(posxml.c_str());
file<> fdoc(realPath.c_str());
if(GetXMLDocumentHandle(fdoc, doc, error) == false)
......@@ -1417,7 +1425,8 @@ public:
static bool JsonConvertPost(const Document &srcdoc, Document &desdoc, string key, string values, string &lasterror)
{
xml_document<> doc;
string posxml;
//string posxml;
string currPath;
stringstream error;
if(key.empty() || values.empty())
......@@ -1434,25 +1443,31 @@ public:
return false;
}
GetProcPath(posxml);
GetProcPath(currPath);
string realPath = currPath;
QString filename = Tool::ReadCfg(CFG_SECTION_XMLFILENAME, XML_FREEMUD_CLIENT).toString();
posxml.append(filename.toStdString());
QLOG_DEBUG() << "JsonConvertPost xml name :" << QString::fromStdString(posxml);
realPath.append(filename.toStdString());
if(!QFile::exists(QString::fromStdString(realPath))) {
realPath = currPath + XML_FREEMUD_CLIENT;
}
QLOG_DEBUG() << "JsonConvertPost xml name :" << QString::fromStdString(realPath);
#ifdef WIN32
if(_access(posxml.data(), 0) == -1)
if(_access(realPath.data(), 0) == -1)
#else
if(access(posxml.data(), F_OK) == -1)
if(access(realPath.data(), F_OK) == -1)
#endif
{
error << posxml << " not found";
error << realPath << " not found";
lasterror = error.str();
return false;
}
try
{
file<> fdoc(posxml.c_str());
file<> fdoc(realPath.c_str());
if(GetXMLDocumentHandle(fdoc, doc, error) == false)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment