diff options
Diffstat (limited to 'desktop/source/pkgchk/unopkg/unopkg_misc.cxx')
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_misc.cxx | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index c7b5e67aa155..52b4ab884a1b 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -524,112 +524,6 @@ Reference<XComponentContext> getUNO( return xComponentContext; } -//Determines if a folder does not contains a folder. -//Return false may also mean that the status could not be determined -//because some error occurred. -bool hasNoFolder(OUString const & folderUrl) -{ - bool ret = false; - OUString url = folderUrl; - ::rtl::Bootstrap::expandMacros(url); - ::osl::Directory dir(url); - osl::File::RC rc = dir.open(); - if (rc == osl::File::E_None) - { - bool bFolderExist = false; - osl::DirectoryItem i; - osl::File::RC rcNext = osl::File::E_None; - while ( (rcNext = dir.getNextItem(i)) == osl::File::E_None) - { - osl::FileStatus stat(osl_FileStatus_Mask_Type); - if (i.getFileStatus(stat) == osl::File::E_None) - { - if (stat.getFileType() == osl::FileStatus::Directory) - { - bFolderExist = true; - break; - } - } - else - { - dp_misc::writeConsole( - OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n")); - break; - } - i = osl::DirectoryItem(); - } - - if (rcNext == osl::File::E_NOENT || - rcNext == osl::File::E_None) - { - if (!bFolderExist) - ret = true; - } - else - { - dp_misc::writeConsole( - OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n")); - } - - dir.close(); - } - else - { - dp_misc::writeConsole( - OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n")); - } - return ret; -} - -void removeFolder(OUString const & folderUrl) -{ - OUString url = folderUrl; - ::rtl::Bootstrap::expandMacros(url); - ::osl::Directory dir(url); - ::osl::File::RC rc = dir.open(); - if (rc == osl::File::E_None) - { - ::osl::DirectoryItem i; - ::osl::File::RC rcNext = ::osl::File::E_None; - while ( (rcNext = dir.getNextItem(i)) == ::osl::File::E_None) - { - ::osl::FileStatus stat(osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL); - if (i.getFileStatus(stat) == ::osl::File::E_None) - { - ::osl::FileStatus::Type t = stat.getFileType(); - if (t == ::osl::FileStatus::Directory) - { - //remove folder - removeFolder(stat.getFileURL()); - } - else if (t == ::osl::FileStatus::Regular) - { - //remove file - ::osl::File::remove(stat.getFileURL()); - } - else - { - OSL_ASSERT(0); - } - } - else - { - dp_misc::writeConsole( - OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n")); - break; - } - i = ::osl::DirectoryItem(); - } - dir.close(); - ::osl::Directory::remove(url); - } - else if (rc != osl::File::E_NOENT) - { - dp_misc::writeConsole( - OUSTR("unopkg: Error while removing ") + url + OUSTR("\n")); - } -} - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |