This commit is contained in:
Oleg Korshul
2018-04-26 18:29:39 +03:00
parent b9b843f25d
commit 261e48227d
4 changed files with 38 additions and 3 deletions

View File

@ -314,7 +314,7 @@ namespace NSDirectory
static bool Exists(const std::wstring& strDirectory)
{
#if defined(_WIN32) || defined (_WIN64)
std::wstring sDirectoryW = CorrectPathW(strDirectory);
std::wstring strDirectoryW = CorrectPathW(strDirectory);
DWORD dwAttrib = ::GetFileAttributesW(strDirectoryW.c_str());
return (dwAttrib != INVALID_FILE_ATTRIBUTES && 0 != (dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
#elif __linux__

View File

@ -857,7 +857,7 @@ namespace NSFile
static bool Exists(const std::wstring& strFileName)
{
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
std::wstring sFileNameW = CorrectPathW(sFileName);
std::wstring sFileNameW = CorrectPathW(strFileName);
FILE* pFile = NULL;
if ( 0 != _wfopen_s( &pFile, sFileNameW.c_str(), L"rb"))
return false;

View File

@ -691,6 +691,41 @@ public:
sXml += L"</Relationships>";
NSFile::CFileBinary::SaveToFile(m_sFolder + L"/_rels/.rels", sXml);
}
else
{
std::wstring sFileFound = sFile.substr(m_sFolder.length());
std::wstring::size_type posRemove = sFileFound.find(L"/_xmlsignatures/");
if (std::wstring::npos != posRemove)
sFileFound = sFileFound.substr(posRemove + 16);
std::wstring sOriginRels = m_sFolder + L"/_xmlsignatures/_rels/origin.sigs.rels";
XmlUtils::CXmlNode oRels;
if (!oRels.FromXmlFile(sOriginRels))
return;
sXml = L"<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">";
XmlUtils::CXmlNodes oNodes;
if (oRels.GetNodes(L"*", oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
if (L"Relationship" == oNode.GetName() &&
L"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature" == oNode.GetAttribute(L"Type") &&
sFileFound == oNode.GetAttribute(L"Target"))
continue;
sXml += oNode.GetXml();
}
}
sXml += L"</Relationships>";
NSFile::CFileBinary::SaveToFile(sOriginRels, sXml);
}
}
};

View File

@ -63,7 +63,7 @@ HRESULT COfficeUtils::ExtractToDirectory(const std::wstring& _zipFile, const std
HRESULT COfficeUtils::CompressFileOrDirectory(const std::wstring& _name, const std::wstring& _outputFile, bool bSorted, short level)
{
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
std::wstring name = CorrectPathW(_name);
std::wstring name = _name;//CorrectPathW(_name);
std::wstring outputFile = CorrectPathW(_outputFile);
#else
std::wstring name = _name;