summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-08-21 18:06:16 +0200
committerPetr Mladek <pmladek@suse.cz>2012-08-21 18:43:31 +0200
commit8beb667105e30b37b322fc62c8ebf923101b679f (patch)
treeb1a3829cace7726f9e715196d5e8a9ff70bf16ca
parent636e8f07d17f33e3b67137be805f8a0fdf3e0299 (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> Signed-off-by: Michael Stahl <mstahl@redhat.com> Signed-off-by: Petr Mladek <pmladek@suse.cz>
-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