summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-08-22 17:36:15 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2016-08-24 23:30:09 +0000
commit16d5b5195c2550aaec856376b7016d723f6950b6 (patch)
tree66fbd5dcf342ed1cdc4183c2a9ce7e012106853d
parenteadac475f6ecca456e1c415db679145d6f4452b9 (diff)
tdf#101661: Report XDG_{DOCUMENTS,TEMPLATES}_DIR only when it exists
...as had been done in the GConf-based backend prior to 3cf557c12d27f1b2250e69a543136da098112d80 "drop gconf integration as per ESC decision". Change-Id: I56f256aaec542e0a62fc30a37d5c982e93e77812 (cherry picked from commit 4278cac8935339dddfa5473490124d11061a0b38) Reviewed-on: https://gerrit.libreoffice.org/28344 Reviewed-by: Eike Rathke <erack@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--shell/source/backends/desktopbe/desktopbackend.cxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx
index 550e87a49d34..fdbe4d4e9d61 100644
--- a/shell/source/backends/desktopbe/desktopbackend.cxx
+++ b/shell/source/backends/desktopbe/desktopbackend.cxx
@@ -252,6 +252,14 @@ OUString xdg_user_dir_lookup (const char *type)
return aHomeDirURL + "/" + OUString::createFromAscii(type);
}
+css::uno::Any xdgDirectoryIfExists(char const * type) {
+ auto url = xdg_user_dir_lookup(type);
+ return css::uno::Any(
+ osl::Directory(url).open() == osl::FileBase::E_None
+ ? css::beans::Optional<css::uno::Any>(true, css::uno::Any(url))
+ : css::beans::Optional<css::uno::Any>(false, css::uno::Any()));
+}
+
} // namespace
css::uno::Any Default::getPropertyValue(OUString const & PropertyName)
@@ -261,16 +269,12 @@ css::uno::Any Default::getPropertyValue(OUString const & PropertyName)
{
if (PropertyName == "TemplatePathVariable")
{
- OUString aDirURL = xdg_user_dir_lookup("Templates");
- css::uno::Any aValue(aDirURL);
- return css::uno::makeAny(css::beans::Optional<css::uno::Any>(true, aValue));
+ return xdgDirectoryIfExists("Templates");
}
if (PropertyName == "WorkPathVariable")
{
- OUString aDirURL = xdg_user_dir_lookup("Documents");
- css::uno::Any aValue(aDirURL);
- return css::uno::makeAny(css::beans::Optional<css::uno::Any>(true, aValue));
+ return xdgDirectoryIfExists("Documents");
}
if ( PropertyName == "EnableATToolSupport" ||