[Libreoffice-commits] .: Branch 'libreoffice-3-6' - desktop/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Aug 21 09:20:36 PDT 2012


 desktop/source/app/app.cxx |   27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

New commits:
commit 471b121a585dfdf6c6040084ec108100ef89de77
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Aug 21 18:06:16 2012 +0200

    fdo#53655: Ignore failure to remove directories (as happens on Windows XP)
    
    ...plus, add error codes to other failure's exception strings, just in case...
    
    Change-Id: Ic21c52e0ab52ed1752745e86bde214aee7c3c208
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 4611ef3..d929787 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -165,32 +165,39 @@ void removeTree(OUString const & url) {
         }
         if (rc != osl::FileBase::E_None) {
             throw css::uno::RuntimeException(
-                "cannot iterate directory " + url,
+                ("cannot iterate directory " + url + ": "
+                 + OUString::valueOf(static_cast< sal_Int32 >(rc))),
                 css::uno::Reference< css::uno::XInterface >());
         }
         osl::FileStatus stat(
             osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName |
             osl_FileStatus_Mask_FileURL);
-        if (i.getFileStatus(stat) != osl::FileBase::E_None) {
+        rc = i.getFileStatus(stat);
+        if (rc != osl::FileBase::E_None) {
             throw css::uno::RuntimeException(
-                "cannot stat in directory " + url,
+                ("cannot stat in directory " + url + ": "
+                 + OUString::valueOf(static_cast< sal_Int32 >(rc))),
                 css::uno::Reference< css::uno::XInterface >());
         }
         if (stat.getFileType() == osl::FileStatus::Directory) { //TODO: symlinks
             removeTree(stat.getFileURL());
         } else {
-            if (osl::File::remove(stat.getFileURL()) != osl::FileBase::E_None) {
+            rc = osl::File::remove(stat.getFileURL());
+            if (rc != osl::FileBase::E_None) {
                 throw css::uno::RuntimeException(
-                    "cannot remove file " + stat.getFileURL(),
+                    ("cannot remove file " + stat.getFileURL() + ": "
+                     + OUString::valueOf(static_cast< sal_Int32 >(rc))),
                     css::uno::Reference< css::uno::XInterface >());
             }
         }
     }
-    if (osl::Directory::remove(url) != osl::FileBase::E_None) {
-        throw css::uno::RuntimeException(
-            "cannot remove directory " + url,
-            css::uno::Reference< css::uno::XInterface >());
-    }
+    osl::FileBase::RC rc = osl::Directory::remove(url);
+    SAL_WARN_IF(
+        rc != osl::FileBase::E_None, "desktop",
+        "cannot remove directory " << url << ": " +rc);
+        // at least on Windows XP removing some existing directories fails with
+        // osl::FileBase::E_ACCESS because they are read-only; but keeping those
+        // directories around should be harmless once they are empty
 }
 
 // Remove any existing UserInstallation's user/extensions/bundled cache


More information about the Libreoffice-commits mailing list