summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-08-22 17:36:15 +0200
committerEike Rathke <erack@redhat.com>2016-08-23 14:01:58 +0000
commit15a504308d27dfcb605da320c9231227aca415e1 (patch)
treed875036fe32213964e07915986eabd3ba5c827ba /shell
parent2005eb1c0fb2c7170af076a0db9a4e3e1f6892ac (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/28343 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'shell')
-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" ||