Commit 6452e7a1 authored by Oleg Korshul's avatar Oleg Korshul

disable xvfb in config

parent 2ca535d9
...@@ -90,6 +90,23 @@ static std::wstring CorrectHtmlPath(const std::wstring& sPath) ...@@ -90,6 +90,23 @@ static std::wstring CorrectHtmlPath(const std::wstring& sPath)
return L"file:///" + sReturn; return L"file:///" + sReturn;
} }
static bool IsLinuxXVFB()
{
std::wstring sProcess = NSFile::GetProcessDirectory() + L"/";
std::wstring sPathConfig = sProcess + L"DoctRenderer.config";
XmlUtils::CXmlNode oNode;
if (oNode.FromXmlFile(sPathConfig))
{
XmlUtils::CXmlNodes oNodes;
if (oNode.GetNodes(L"htmlnoxvfb", oNodes))
{
if (oNodes.GetCount() == 1)
return false;
}
}
return true;
}
static void GetScriptsPath(NSStringUtils::CStringBuilder& oBuilder) static void GetScriptsPath(NSStringUtils::CStringBuilder& oBuilder)
{ {
std::wstring sProcess = NSFile::GetProcessDirectory() + L"/"; std::wstring sProcess = NSFile::GetProcessDirectory() + L"/";
...@@ -336,37 +353,40 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr ...@@ -336,37 +353,40 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
if (std::string::npos != sProgramm.find_last_of('/')) if (std::string::npos != sProgramm.find_last_of('/'))
sLibraryDir = "LD_LIBRARY_PATH=" + sProgramm.substr(0, sProgramm.find_last_of('/')); sLibraryDir = "LD_LIBRARY_PATH=" + sProgramm.substr(0, sProgramm.find_last_of('/'));
#ifdef asc_static_link_libstd if (!IsLinuxXVFB())
const char* nargs[2]; {
nargs[0] = sXmlA.c_str(); const char* nargs[2];
nargs[1] = NULL; nargs[0] = sXmlA.c_str();
nargs[1] = NULL;
const char* nenv[3];
nenv[0] = sLibraryDir.c_str(); const char* nenv[3];
nenv[1] = "DISPLAY=:0"; nenv[0] = sLibraryDir.c_str();
nenv[2] = NULL; nenv[1] = "DISPLAY=:0";
nenv[2] = NULL;
execve(sProgramm.c_str(),
(char * const *)nargs, execve(sProgramm.c_str(),
(char * const *)nenv); (char * const *)nargs,
exit(EXIT_SUCCESS); (char * const *)nenv);
#else exit(EXIT_SUCCESS);
const char* nargs[6]; }
nargs[0] = "-a"; else
nargs[1] = "--auto-servernum"; {
nargs[2] = "--server-num=1"; const char* nargs[6];
nargs[3] = sProgramm.c_str(); nargs[0] = "-a";
nargs[4] = sXmlA.c_str(); nargs[1] = "--auto-servernum";
nargs[5] = NULL; nargs[2] = "--server-num=1";
nargs[3] = sProgramm.c_str();
const char* nenv[3]; nargs[4] = sXmlA.c_str();
nenv[0] = sLibraryDir.c_str(); nargs[5] = NULL;
nenv[1] = NULL;//"DISPLAY=:99";
nenv[2] = NULL; const char* nenv[3];
nenv[0] = sLibraryDir.c_str();
execve("/usr/bin/xvfb-run", (char * const *)nargs, (char * const *)nenv); nenv[1] = NULL;//"DISPLAY=:99";
exit(EXIT_SUCCESS); nenv[2] = NULL;
#endif
execve("/usr/bin/xvfb-run", (char * const *)nargs, (char * const *)nenv);
exit(EXIT_SUCCESS);
}
break; break;
} }
......
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