Commit d6c28e21 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

(1.0.0.225) remove dir if no pptx

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53167 954022d7-b5bf-4e40-9824-e11837661b57
parent 785df2ef
...@@ -149,7 +149,10 @@ public: ...@@ -149,7 +149,10 @@ public:
if(m_pOfficeUtils == NULL) if(m_pOfficeUtils == NULL)
return S_FALSE; return S_FALSE;
HRESULT hr = m_pOfficeUtils->ExtractToDirectory( sSrcFileName, localTempDir.AllocSysString(), NULL, 0);
BSTR bsParam = localTempDir.AllocSysString();
HRESULT hr = m_pOfficeUtils->ExtractToDirectory( sSrcFileName, bsParam, NULL, 0);
SysFreeString(bsParam);
if(hr != S_OK) if(hr != S_OK)
return hr; return hr;
...@@ -170,6 +173,7 @@ public: ...@@ -170,6 +173,7 @@ public:
smart_ptr<PPTX::Presentation> presentation = m_pFolder->get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>(); smart_ptr<PPTX::Presentation> presentation = m_pFolder->get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
if (!presentation.is_init()) if (!presentation.is_init())
{ {
RemoveDirOrFile(m_strTempDir, false);
return S_FALSE; return S_FALSE;
} }
...@@ -310,6 +314,7 @@ public: ...@@ -310,6 +314,7 @@ public:
smart_ptr<PPTX::Presentation> presentation = m_pFolder->get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>(); smart_ptr<PPTX::Presentation> presentation = m_pFolder->get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
if (!presentation.is_init()) if (!presentation.is_init())
{ {
RemoveDirOrFile(m_strTempDir, false);
return S_FALSE; return S_FALSE;
} }
...@@ -370,6 +375,7 @@ public: ...@@ -370,6 +375,7 @@ public:
smart_ptr<PPTX::Presentation> presentation = m_pFolder->get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>(); smart_ptr<PPTX::Presentation> presentation = m_pFolder->get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
if (!presentation.is_init()) if (!presentation.is_init())
{ {
RemoveDirOrFile(m_strTempDir, false);
return S_FALSE; return S_FALSE;
} }
...@@ -437,7 +443,7 @@ public: ...@@ -437,7 +443,7 @@ public:
private: private:
INT32 RemoveDirOrFile(CString sPath) INT32 RemoveDirOrFile(CString sPath, bool bIsRemoveHead = true)
{ {
DWORD dwFileAttrib = ::GetFileAttributes( sPath ); DWORD dwFileAttrib = ::GetFileAttributes( sPath );
if( dwFileAttrib != INVALID_FILE_ATTRIBUTES ) if( dwFileAttrib != INVALID_FILE_ATTRIBUTES )
...@@ -465,9 +471,13 @@ private: ...@@ -465,9 +471,13 @@ private:
} }
while( FindNextFile( Handle, &FindData ) != 0 ); while( FindNextFile( Handle, &FindData ) != 0 );
FindClose( Handle ); FindClose( Handle );
BOOL bRes = RemoveDirectory( sPath );
if( FALSE == bRes ) if (bIsRemoveHead)
dwResult += 1; {
BOOL bRes = RemoveDirectory( sPath );
if( FALSE == bRes )
dwResult += 1;
}
} }
else else
{ {
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//0 //0
//0 //0
//224 //225
#define INTVER 1,0,0,224 #define INTVER 1,0,0,225
#define STRVER "1,0,0,224\0" #define STRVER "1,0,0,225\0"
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