summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-08-21 18:06:16 +0200
committerMichael Meeks <michael.meeks@suse.com>2012-08-21 17:20:12 +0100
commit471b121a585dfdf6c6040084ec108100ef89de77 (patch)
treedc628b2e2b28708122af1a4914b43bc9836a440c /desktop
parentfa4fec47a8bb713f960acb474920f2c640e1c58a (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 Signed-off-by: Michael Meeks <michael.meeks@suse.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/app.cxx27
1 files changed, 17 insertions, 10 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 4611ef3962fd..d92978720d64 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