diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-01-20 15:23:06 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-01-21 10:23:44 +0100 |
commit | 4a25fb867f7cc0a0fc21c4079c84fadec6647ad1 (patch) | |
tree | 04dd28ed5dae7b077ae7d097e078ac2b123a394c /xmlsecurity | |
parent | fa8c85fa90e9565a357b247a69f930098d11ff84 (diff) |
Make TempFile destructor remove temp directory recursively
Change-Id: Idcfa93ffe86112477ad81bcbf74b8e5b858423f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87080
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/nssinitializer.cxx | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx index 5b31fe984f50..d64ea10a05a0 100644 --- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx +++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx @@ -69,65 +69,6 @@ class InitNSSPrivate private: std::unique_ptr<utl::TempFile> m_pTempFileDatabaseDirectory; - static void scanDirsAndFiles(OUString const & rDirURL, std::vector<OUString> & rDirs, std::vector<OUString> & rFiles) - { - if (rDirURL.isEmpty()) - return; - osl::Directory aDirectory(rDirURL); - - if (osl::FileBase::E_None != aDirectory.open()) - return; - - osl::DirectoryItem aDirectoryItem; - - while (osl::FileBase::E_None == aDirectory.getNextItem(aDirectoryItem)) - { - osl::FileStatus aFileStatus(osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL | osl_FileStatus_Mask_FileName); - - if (osl::FileBase::E_None == aDirectoryItem.getFileStatus(aFileStatus)) - { - if (aFileStatus.isDirectory()) - { - const OUString aFileName(aFileStatus.getFileName()); - if (!aFileName.isEmpty()) - rDirs.push_back(aFileName); - } - else if (aFileStatus.isRegular()) - { - const OUString aFileName(aFileStatus.getFileName()); - if (!aFileName.isEmpty()) - rFiles.push_back(aFileName); - - } - } - } - } - - static bool deleteDirRecursively(OUString const & rDirURL) - { - std::vector<OUString> aDirs; - std::vector<OUString> aFiles; - bool bError(false); - - scanDirsAndFiles(rDirURL, aDirs, aFiles); - - for (const auto& sDir : aDirs) - { - const OUString aNewDirURL(rDirURL + "/" + sDir); - bError |= deleteDirRecursively(aNewDirURL); - } - - for (const auto& sFile : aFiles) - { - OUString aNewFileURL(rDirURL + "/" + sFile); - bError |= (osl::FileBase::E_None != osl::File::remove(aNewFileURL)); - } - - bError |= (osl::FileBase::E_None != osl::Directory::remove(rDirURL)); - - return bError; - } - public: OUString getTempDatabasePath() { @@ -143,7 +84,6 @@ public: { if (m_pTempFileDatabaseDirectory) { - deleteDirRecursively(m_pTempFileDatabaseDirectory->GetURL()); m_pTempFileDatabaseDirectory.reset(); } } |