mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Merge pull request #1274 from ONLYOFFICE/fix/x2ttester
Add enviroment vars support
This commit is contained in:
@ -30,6 +30,9 @@ You need to create an xml configuration file. It must contain:
|
||||
# (non-required) trough conversion (format) -> (*t format) -> (output formats) (default - 0). Directory with *t files - outputDirectory/_t.
|
||||
<troughConversion> </troughConversion>
|
||||
|
||||
# (non-required) save environment vars to x2t (for example "X2T_MEMORY_LIMIT") (default - 0).
|
||||
<saveEnvironment> </saveEnvironment>
|
||||
|
||||
# (non-required) timestamp in report file name (default - 1)
|
||||
<timestamp> </timestamp>
|
||||
|
||||
|
||||
@ -268,6 +268,7 @@ Cx2tTester::Cx2tTester(const std::wstring& configPath)
|
||||
m_bIsFilenameCsvTxtParams = true;
|
||||
m_bIsFilenamePassword = true;
|
||||
m_bTroughConversion = false;
|
||||
m_bSaveEnvironment = false;
|
||||
m_defaultCsvDelimiter = L";";
|
||||
m_defaultCsvTxtEndcoding = L"UTF-8";
|
||||
m_inputFormatsList = CFormatsList::GetDefaultExts();
|
||||
@ -363,6 +364,7 @@ void Cx2tTester::SetConfig(const std::wstring& configPath)
|
||||
else if(name == L"filenameCsvTxtParams" && !node.GetText().empty()) m_bIsFilenameCsvTxtParams = std::stoi(node.GetText());
|
||||
else if(name == L"filenamePassword" && !node.GetText().empty()) m_bIsFilenamePassword = std::stoi(node.GetText());
|
||||
else if(name == L"troughConversion" && !node.GetText().empty()) m_bTroughConversion = std::stoi(node.GetText());
|
||||
else if(name == L"saveEnvironment" && !node.GetText().empty()) m_bSaveEnvironment = std::stoi(node.GetText());
|
||||
else if(name == L"defaultCsvTxtEncoding" && !node.GetText().empty()) m_defaultCsvTxtEndcoding = node.GetText();
|
||||
else if(name == L"defaultCsvDelimiter" && !node.GetText().empty()) m_defaultCsvDelimiter = (wchar_t)std::stoi(node.GetText(), nullptr, 16);
|
||||
else if(name == L"inputFilesList" && !node.GetText().empty())
|
||||
@ -637,6 +639,7 @@ void Cx2tTester::Convert(const std::vector<std::wstring>& files, bool bNoDirecto
|
||||
converter->SetPassword(password);
|
||||
converter->SetTimeout(m_timeout);
|
||||
converter->SetFilesCount(files.size(), i + 1);
|
||||
converter->SetSaveEnvironment(m_bSaveEnvironment);
|
||||
converter->DestroyOnFinish();
|
||||
m_currentProc++;
|
||||
|
||||
@ -811,6 +814,11 @@ void CConverter::SetFilesCount(int totalFiles, int currFile)
|
||||
m_currFile = currFile;
|
||||
}
|
||||
|
||||
void CConverter::SetSaveEnvironment(bool bSaveEnvironment)
|
||||
{
|
||||
m_bSaveEnvironment = bSaveEnvironment;
|
||||
}
|
||||
|
||||
|
||||
DWORD CConverter::ThreadProc()
|
||||
{
|
||||
@ -941,7 +949,7 @@ DWORD CConverter::ThreadProc()
|
||||
#endif // WIN32
|
||||
|
||||
bool is_timeout = false;
|
||||
int exit_code = NSX2T::Convert(NSFile::GetDirectoryName(m_x2tPath), xml_params_file, m_timeout, &is_timeout);
|
||||
int exit_code = NSX2T::Convert(NSFile::GetDirectoryName(m_x2tPath), xml_params_file, m_timeout, &is_timeout, m_bSaveEnvironment);
|
||||
|
||||
bool exist;
|
||||
if(output_format & AVS_OFFICESTUDIO_FILE_IMAGE)
|
||||
|
||||
@ -153,6 +153,7 @@ private:
|
||||
|
||||
// format -> *t format -> all formats
|
||||
bool m_bTroughConversion;
|
||||
bool m_bSaveEnvironment;
|
||||
|
||||
std::vector<std::wstring> m_deleteLaterFiles;
|
||||
std::vector<std::wstring> m_deleteLaterDirectories;
|
||||
@ -180,6 +181,7 @@ public:
|
||||
void SetPassword(const std::wstring& password);
|
||||
void SetTimeout(unsigned long timeout);
|
||||
void SetFilesCount(int totalFiles, int currFile);
|
||||
void SetSaveEnvironment(bool bSaveEnvironment);
|
||||
|
||||
virtual DWORD ThreadProc();
|
||||
|
||||
@ -204,6 +206,7 @@ private:
|
||||
bool m_bIsErrorsOnly;
|
||||
bool m_bIsDeleteOk;
|
||||
bool m_bIsTrough;
|
||||
bool m_bSaveEnvironment;
|
||||
|
||||
int m_totalFiles;
|
||||
int m_currFile;
|
||||
|
||||
Reference in New Issue
Block a user