shell/source/backends/desktopbe/desktopbackend.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
New commits: commit 15a504308d27dfcb605da320c9231227aca415e1 Author: Stephan Bergmann <sberg...@redhat.com> Date: Mon Aug 22 17:36:15 2016 +0200 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 <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx index 550e87a..fdbe4d4 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" || _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits