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,7 +353,8 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr ...@@ -336,7 +353,8 @@ 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]; const char* nargs[2];
nargs[0] = sXmlA.c_str(); nargs[0] = sXmlA.c_str();
nargs[1] = NULL; nargs[1] = NULL;
...@@ -350,7 +368,9 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr ...@@ -350,7 +368,9 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
(char * const *)nargs, (char * const *)nargs,
(char * const *)nenv); (char * const *)nenv);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
#else }
else
{
const char* nargs[6]; const char* nargs[6];
nargs[0] = "-a"; nargs[0] = "-a";
nargs[1] = "--auto-servernum"; nargs[1] = "--auto-servernum";
...@@ -366,7 +386,7 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr ...@@ -366,7 +386,7 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
execve("/usr/bin/xvfb-run", (char * const *)nargs, (char * const *)nenv); execve("/usr/bin/xvfb-run", (char * const *)nargs, (char * const *)nenv);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
#endif }
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