basic/source/runtime/methods.cxx | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-)
New commits: commit 6c3ab93dfcdec3f9232fa95c6f80978725db4b73 Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> AuthorDate: Mon Jan 20 15:52:42 2020 +0100 Commit: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> CommitDate: Tue Jan 21 10:26:53 2020 +0100 Use deleteDirRecursively from comphelper Change-Id: I4ad1226e5b08fc3abbf94440ea435fc9109005b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87081 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 8d2ecb974d45..048fa1a8bb64 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -43,6 +43,7 @@ #include <i18nlangtag/lang.h> #include <rtl/string.hxx> #include <sal/log.hxx> +#include <comphelper/DirectoryHelper.hxx> #include <runtime.hxx> #include <sbunoobj.hxx> @@ -638,8 +639,6 @@ void SbRtl_MkDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite) } -// In OSL only empty directories can be deleted -// so we have to delete all files recursively static void implRemoveDirRecursive( const OUString& aDirPath ) { DirectoryItem aItem; @@ -664,40 +663,9 @@ static void implRemoveDirRecursive( const OUString& aDirPath ) StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND ); return; } - - for( ;; ) - { - DirectoryItem aItem2; - nRet = aDir.getNextItem( aItem2 ); - if( nRet != FileBase::E_None ) - { - break; - } - // Handle flags - FileStatus aFileStatus2( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL ); - nRet = aItem2.getFileStatus( aFileStatus2 ); - if( nRet != FileBase::E_None ) - { - SAL_WARN("basic", "getFileStatus failed"); - continue; - } - OUString aPath = aFileStatus2.getFileURL(); - - // Directory? - FileStatus::Type aType2 = aFileStatus2.getFileType(); - bool bFolder2 = isFolder( aType2 ); - if( bFolder2 ) - { - implRemoveDirRecursive( aPath ); - } - else - { - File::remove( aPath ); - } - } aDir.close(); - Directory::remove( aDirPath ); + comphelper::DirectoryHelper::deleteDirRecursively(aDirPath); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits