diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-08-21 18:06:16 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-08-21 18:06:16 +0200 |
commit | a8cdce148c76c93c5d41820610d6e6ac175e03a7 (patch) | |
tree | d6b8cee61326f62456b177bbff5ac1fb7725475a /desktop | |
parent | fd99896fcd4826e5326fe01dd28f168cf1844fd4 (diff) |
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
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/app.cxx | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 87c34e8f1020..5409d56de958 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -170,32 +170,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 |