Petr Mladek píše v Út 06. 12. 2011 v 19:57 +0100:
Tomáš Chvátal píše v Po 05. 12. 2011 v 10:40 +0100:
Hi guys,
After updating to 3.5 quite few people reported that their
configuration is gone and they have default setup.
The reason for this is that 3.5 now uses XDG spec
~/.config/libreoffice instead of ~/.libreoffice. Simple copy of later
folder to replace the former one solved the issued for everyone.
IMHO, we should check both prefixes: $XDG_CONFIG_HOME and $HOME in all
cases.
I tried to implement it, see the attached patch. Unfortunately, it does
not work because it do the migration in the second run and it uses the
same directory name in $HOME/.config like in used in $HOME => it finds
the new clean configuration from the first run and migrates it into
itself.
=> we should apply this patch after we update the version of the config
directory or after we change another name.
Well, we might need something similar to fix problem with the set
$XDG_CONFIG_HOME
It is too late for me to continue now.
Good night,
Petr
From 097229284c085597da6c2b62281fe154aa027b0a Mon Sep 17 00:00:00 2001
From: Petr Mladek <pmladek@suse.cz>
Date: Tue, 6 Dec 2011 20:58:56 +0100
Subject: [PATCH] attempt to migrate old config from XDG path and home dir
IMPORTANT: it does not work because it do the migration in the second run;
it first check the newly created location and migrates in into itself
we might need something similar to fix problem with set XDG path
---
desktop/source/migration/migration.cxx | 58 ++++++++++------------
desktop/source/migration/migration_impl.hxx | 1 +
officecfg/registry/data/org/openoffice/Setup.xcu | 2 +-
3 files changed, 29 insertions(+), 32 deletions(-)
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 7520eb8..639fea8 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -533,6 +533,23 @@ static FileBase::RC _checkAndCreateDirectory(INetURLObject& dirURL)
return result;
}
+void MigrationImpl::checkConfiguration( install_info &aInfo, const ::rtl::OUString aUserInst,
const ::rtl::OUString aVersion)
+{
+ fprintf(stderr, "test path: %s\n", ::rtl::OUStringToOString (aUserInst,
RTL_TEXTENCODING_UTF8).pData->buffer);
+ try
+ {
+ INetURLObject aObj(aUserInst);
+ ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ),
uno::Reference< ucb::XCommandEnvironment > () );
+ aCnt.isDocument();
+ aInfo.userdata = aObj.GetMainURL( INetURLObject::NO_DECODE );
+ aInfo.productname = aVersion;
+ }
+ catch (const uno::Exception&)
+ {
+ }
+}
+
+
install_info MigrationImpl::findInstallation(const strings_v& rVersions)
{
install_info aInfo;
@@ -554,40 +571,19 @@ install_info MigrationImpl::findInstallation(const strings_v& rVersions)
{
::rtl::OUString aUserInst;
osl::Security().getConfigDir( aUserInst );
+ aUserInst += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + aProfileName;
+ checkConfiguration( aInfo, aUserInst, aVersion);
+
#if defined UNX && ! defined MACOSX
- const char* pXDGCfgHome = getenv("XDG_CONFIG_HOME");
- // cater for XDG_CONFIG_HOME change
- // If XDG_CONFIG_HOME is set then we;
- // assume the user knows what they are doing ( room for improvement here, we could
- // of course search the default config dir etc. also - but this is more complex,
- // we would need to weigh results from the current config dir against matches in
- // the 'old' config dir etc. ) - currently we just use the returned config dir.
- // If XDG_CONFIG_HOME is NOT set;
- // assume then we should now using the default $HOME/,config config location for
- // our user profiles, however *all* previous libreoffice and openoffice.org
- // configurations will be in the 'old' config directory and that's where we need
- // to search - we convert the returned config dir to the 'old' dir
- if ( !pXDGCfgHome && aUserInst.endsWithAsciiL( XDG_CONFIG_PART, sizeof(
XDG_CONFIG_PART ) - 1 ) )
- aUserInst = aUserInst.copy( 0, aUserInst.getLength() - sizeof( XDG_CONFIG_PART )
+ 2 ); // remove trailing '.config' ( but leave the terminating '/' )
-#endif
- if ( aUserInst.getLength() && aUserInst[ aUserInst.getLength()-1 ] != '/' )
- aUserInst += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
-#if defined UNX && ! defined MACOSX
- // tribute to whoever had the "great" idea to use different names on Windows and Unix
- aUserInst += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("."));
-#endif
- aUserInst += aProfileName;
- try
- {
- INetURLObject aObj(aUserInst);
- ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ),
uno::Reference< ucb::XCommandEnvironment > () );
- aCnt.isDocument();
- aInfo.userdata = aObj.GetMainURL( INetURLObject::NO_DECODE );
- aInfo.productname = aVersion;
- }
- catch (const uno::Exception&)
+ // we switched to XDG_CONFIG on Linux; try older configuration paths in $HOME
+ if (aInfo.userdata.isEmpty())
{
+ osl::Security().getHomeDir( aUserInst );
+ // the old paths were directly in $HOME and thus prefixed by .
+ aUserInst += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/.")) + aProfileName;
+ checkConfiguration( aInfo, aUserInst, aVersion);
}
+#endif
}
++i_ver;
}
diff --git a/desktop/source/migration/migration_impl.hxx
b/desktop/source/migration/migration_impl.hxx
index 2d079ae..9a6e483 100644
--- a/desktop/source/migration/migration_impl.hxx
+++ b/desktop/source/migration/migration_impl.hxx
@@ -210,6 +210,7 @@ private:
bool alreadyMigrated();
migrations_vr readMigrationSteps(const ::rtl::OUString& rMigrationName);
sal_Int32 findPreferedMigrationProcess(const migrations_available&);
+ void checkConfiguration( install_info &aInfo, const ::rtl::OUString aUserInst, const
::rtl::OUString aVersion);
install_info findInstallation(const strings_v& rVersions);
strings_vr compileFileList();
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.