Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi all,

For fdo#32263 - Config file location, I made a patch as attached
(thanks to Noel, for helpful comments on its initial version and
suggesting to post to this list).

It seems to work well with master, but has one concern; the change
against common_brand.scp leads the path "$HOME/libreoffice" (not
"$HOME/.libreoffice") used in the fallback case, which sounds
uncomfortable to some users including me.
Any thought?

Cheers,
-- Takeshi Abe
From 8ac97074f40abf2ebdfdd5ac71fdc7aab2021309 Mon Sep 17 00:00:00 2001
From: Takeshi Abe <tabe@fixedpoint.jp>
Date: Mon, 30 May 2011 00:03:28 +0900
Subject: [PATCH] fdo#32263

use $HOME/.config unless XDG_CONFIG_HOME is set with respect to
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
moreover, lose dot so as "$HOME/.config/libreoffice".
---
 scp2/source/ooo/common_brand.scp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp
index 3a72af6..8e08d69 100644
--- a/scp2/source/ooo/common_brand.scp
+++ b/scp2/source/ooo/common_brand.scp
@@ -896,7 +896,7 @@ ProfileItem gid_Brand_Profileitem_Bootstrap_Userinstall
   #elif defined MACOSX
     Value = "$SYSUSERCONFIG/%ONEWORDPRODUCTNAME/%USERDIRPRODUCTVERSION";
   #else
-    Value = "$SYSUSERCONFIG/.%LCONEWORDPRODUCTNAME/%USERDIRPRODUCTVERSION";
+    Value = "$SYSUSERCONFIG/%LCONEWORDPRODUCTNAME/%USERDIRPRODUCTVERSION";
   #endif
 End
 
-- 
1.7.2.5

From 57fca01d01b7e1d96a0716acfecacb99ae7322f4 Mon Sep 17 00:00:00 2001
From: Takeshi Abe <tabe@fixedpoint.jp>
Date: Mon, 30 May 2011 00:01:59 +0900
Subject: [PATCH] fdo#32263

use $HOME/.config unless XDG_CONFIG_HOME is set with respect to
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
moreover, lose dot so as "$HOME/.config/libreoffice".
---
 sal/osl/unx/security.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c
index 8cda087..f0f82ec 100644
--- a/sal/osl/unx/security.c
+++ b/sal/osl/unx/security.c
@@ -360,18 +360,37 @@ sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString 
**pustrDire
 
 #ifndef MACOSX
 
+#define DOT_CONFIG "/.config"
+
 static sal_Bool SAL_CALL osl_psz_getConfigDir(oslSecurity Security, sal_Char* pszDirectory, 
sal_uInt32 nMax)
 {
     sal_Char *pStr = getenv("XDG_CONFIG_HOME");
     
     if ((pStr == NULL) || (strlen(pStr) == 0) ||
         (access(pStr, 0) != 0))
-        return (osl_psz_getHomeDir(Security, pszDirectory, nMax));
+    {
+        // a default equal to $HOME/.config should be used.
+        if (!osl_psz_getHomeDir(Security, pszDirectory, nMax))
+            return sal_False;
+        size_t n = strlen(pszDirectory);
+        if (n + sizeof(DOT_CONFIG) < nMax)
+        {
+            strncpy(pszDirectory+n, DOT_CONFIG, sizeof(DOT_CONFIG));
+            if (access(pszDirectory, 0) != 0)
+            {
+                // resort to HOME
+                pszDirectory[n] = '\0';
+            }
+        }
+    }
+    else
+        strncpy(pszDirectory, pStr, nMax);
 
-    strncpy(pszDirectory, pStr, nMax);
     return sal_True;
 }
 
+#undef DOT_CONFIG
+
 #else
 
 /*
-- 
1.7.2.5


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.