summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-10-10 17:37:08 +0200
committerMichael Stahl <mstahl@redhat.com>2014-10-11 00:28:48 +0200
commit124a29f0f8dd805ef1d67bd062e1978a8a88e759 (patch)
tree8b6f8e5f26455396c482d45bb952f8959199453f /desktop
parent3d85ec29ddd73ed996debdcf118f8c32774362ed (diff)
move the removeTree function from desktop to unotools
Change-Id: I98d3f4a68abfee42dac987633878b850134671d3
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/app.cxx54
1 files changed, 2 insertions, 52 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index b2c3433dc4cf..537470442956 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -81,6 +81,7 @@
#include <unotools/bootstrap.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/moduleoptions.hxx>
+#include <unotools/localfilehelper.hxx>
#include <officecfg/Office/Common.hxx>
#include <officecfg/Office/Recovery.hxx>
#include <officecfg/Setup.hxx>
@@ -163,57 +164,6 @@ namespace {
#if HAVE_FEATURE_EXTENSIONS
-void removeTree(OUString const & url) {
- osl::Directory dir(url);
- osl::FileBase::RC rc = dir.open();
- switch (rc) {
- case osl::FileBase::E_None:
- break;
- case osl::FileBase::E_NOENT:
- return; //TODO: SAL_WARN if recursive
- default:
- SAL_WARN("desktop.app", "cannot open directory " << dir.getURL() << ": " << +rc);
- return;
- }
- for (;;) {
- osl::DirectoryItem i;
- rc = dir.getNextItem(i, SAL_MAX_UINT32);
- if (rc == osl::FileBase::E_NOENT) {
- break;
- }
- if (rc != osl::FileBase::E_None) {
- SAL_WARN( "desktop.app", "cannot iterate directory " << dir.getURL() << ": " << +rc);
- break;
- }
- osl::FileStatus stat(
- osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName |
- osl_FileStatus_Mask_FileURL);
- rc = i.getFileStatus(stat);
- if (rc != osl::FileBase::E_None) {
- SAL_WARN( "desktop.app", "cannot stat in directory " << dir.getURL() << ": " << +rc);
- continue;
- }
- if (stat.getFileType() == osl::FileStatus::Directory) { //TODO: symlinks
- removeTree(stat.getFileURL());
- } else {
- rc = osl::File::remove(stat.getFileURL());
- SAL_WARN_IF(
- rc != osl::FileBase::E_None, "desktop.app",
- "cannot remove file " << stat.getFileURL() << ": " << +rc);
- }
- }
- if (dir.isOpen()) {
- rc = dir.close();
- SAL_WARN_IF(
- rc != osl::FileBase::E_None, "desktop.app",
- "cannot close directory " << dir.getURL() << ": " << +rc);
- }
- rc = osl::Directory::remove(url);
- SAL_WARN_IF(
- rc != osl::FileBase::E_None, "desktop.app",
- "cannot remove directory " << url << ": " << +rc);
-}
-
// Remove any existing UserInstallation's extensions cache data remaining from
// old installations. This addresses at least two problems:
//
@@ -285,7 +235,7 @@ bool cleanExtensionCache() {
SAL_WARN( "desktop.app", "cannot open " << fr.getURL() << " for reading: " << +rc);
break;
}
- removeTree(extDir);
+ utl::removeTree(extDir);
OUString userRcFile(
"$UNO_USER_PACKAGES_CACHE/registry/"
"com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc");