Commit 9bda3e86 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

Сделано разруливание темповой папки, теперь PDF создает свою папку в заданной...

Сделано разруливание темповой папки, теперь PDF создает свою папку в заданной темповой папке, которую он сам и удаляет за собой.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63266 954022d7-b5bf-4e40-9824-e11837661b57
parent f4fde172
...@@ -71,12 +71,16 @@ CPdfRenderer::CPdfRenderer(CApplicationFonts* pAppFonts) ...@@ -71,12 +71,16 @@ CPdfRenderer::CPdfRenderer(CApplicationFonts* pAppFonts)
m_nCounter = 0; m_nCounter = 0;
m_wsTempFolder = L"";
SetTempFolder(NSFile::CFileBinary::GetTempPath()); SetTempFolder(NSFile::CFileBinary::GetTempPath());
} }
CPdfRenderer::~CPdfRenderer() CPdfRenderer::~CPdfRenderer()
{ {
RELEASEOBJECT(m_pDocument); RELEASEOBJECT(m_pDocument);
RELEASEINTERFACE(m_pFontManager); RELEASEINTERFACE(m_pFontManager);
if (L"" != m_wsTempFolder)
NSDirectory::DeleteDirectory(m_wsTempFolder);
} }
void CPdfRenderer::SaveToFile(const std::wstring& wsPath) void CPdfRenderer::SaveToFile(const std::wstring& wsPath)
{ {
...@@ -87,7 +91,17 @@ void CPdfRenderer::SaveToFile(const std::wstring& wsPath) ...@@ -87,7 +91,17 @@ void CPdfRenderer::SaveToFile(const std::wstring& wsPath)
} }
void CPdfRenderer::SetTempFolder(const std::wstring& wsPath) void CPdfRenderer::SetTempFolder(const std::wstring& wsPath)
{ {
m_wsTempFolder = wsPath; if (L"" != m_wsTempFolder)
NSDirectory::DeleteDirectory(m_wsTempFolder);
int nCounter = 0;
m_wsTempFolder = wsPath + L"\\PDF\\";
while (NSDirectory::Exists(m_wsTempFolder))
{
m_wsTempFolder = wsPath + L"\\PDF_" + std::to_wstring(nCounter) + L"\\";
nCounter++;
}
NSDirectory::CreateDirectory(m_wsTempFolder);
} }
std::wstring CPdfRenderer::GetTempFile() std::wstring CPdfRenderer::GetTempFile()
{ {
......
...@@ -919,6 +919,7 @@ void TestMetafile() ...@@ -919,6 +919,7 @@ void TestMetafile()
void TestOnlineBin() void TestOnlineBin()
{ {
std::wstring wsFolderPath = L"D://Test Files//Txt//"; std::wstring wsFolderPath = L"D://Test Files//Txt//";
std::wstring wsTempFolder = L"D://Test Files//Temp//";
CApplicationFonts oFonts; CApplicationFonts oFonts;
oFonts.Initialize(); oFonts.Initialize();
...@@ -932,6 +933,7 @@ void TestOnlineBin() ...@@ -932,6 +933,7 @@ void TestOnlineBin()
std::wstring wsOutPath = wsFolderPath + L"Out.pdf"; std::wstring wsOutPath = wsFolderPath + L"Out.pdf";
CPdfRenderer oRenderer(&oFonts); CPdfRenderer oRenderer(&oFonts);
oRenderer.SetTempFolder(wsTempFolder);
oRenderer.OnlineWordToPdf(wsFilePath, wsOutPath); oRenderer.OnlineWordToPdf(wsFilePath, wsOutPath);
printf("%d of %d %S\n", nIndex, vFiles.size(), vFiles.at(nIndex).c_str()); printf("%d of %d %S\n", nIndex, vFiles.size(), vFiles.at(nIndex).c_str());
......
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