diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-03-01 22:27:56 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-03-01 22:33:31 +0100 |
commit | 76e0d695a41326a5583dbc9702e0ce3b8219b514 (patch) | |
tree | 38de5d0702c9fde0e77b281acf9563844dfe3fb6 | |
parent | 780f5bf5b177f93c8fd9ebd7ff1a322885074c8c (diff) |
Move migrateSettingsIfNecessary into create_user_install
...so that it is only done once (see mail thread starting at
<http://lists.freedesktop.org/archives/libreoffice/2012-February/027058.html>
"User installation migrated onto itself"). Also, checking for the existence
of an old user installation needed to change from ucbhelper::Content::isDocument
to osl::FileStatus::getFileType, as the UCB is not yet initialized at the time
migrateSettingsIfNecessary is now called.
-rw-r--r-- | desktop/source/app/app.cxx | 3 | ||||
-rw-r--r-- | desktop/source/app/userinstall.cxx | 5 | ||||
-rw-r--r-- | desktop/source/migration/migration.cxx | 17 |
3 files changed, 12 insertions, 13 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index e1bd1e0015f4..61746be49902 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -36,7 +36,6 @@ #include "userinstall.hxx" #include "desktopcontext.hxx" #include "exithelper.hxx" -#include "migration.hxx" #include <svtools/javacontext.hxx> #include <com/sun/star/frame/XSessionManagerListener.hpp> @@ -1624,8 +1623,6 @@ int Desktop::Main() // check whether the shutdown is caused by restart pExecGlobals->bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) ); - - Migration::migrateSettingsIfNecessary(); #endif // keep a language options instance... diff --git a/desktop/source/app/userinstall.cxx b/desktop/source/app/userinstall.cxx index 6b1672dd68e1..7fe97299b8d6 100644 --- a/desktop/source/app/userinstall.cxx +++ b/desktop/source/app/userinstall.cxx @@ -26,8 +26,9 @@ * ************************************************************************/ +#include "sal/config.h" - +#include "migration.hxx" #include "userinstall.hxx" #include "langselect.hxx" @@ -261,6 +262,8 @@ namespace desktop { return UserInstall::E_Creation; } } + + Migration::migrateSettingsIfNecessary(); #endif try { diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 4df893a4057c..dd73e3a84400 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -44,7 +44,6 @@ #include <tools/urlobj.hxx> #include <osl/file.hxx> #include <osl/mutex.hxx> -#include <ucbhelper/content.hxx> #include <osl/security.hxx> #include <unotools/configmgr.hxx> @@ -576,17 +575,17 @@ install_info MigrationImpl::findInstallation(const strings_v& rVersions) aUserInst += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); #endif aUserInst += aProfileName; - try + rtl::OUString url( + INetURLObject(aUserInst).GetMainURL(INetURLObject::NO_DECODE)); + osl::DirectoryItem item; + osl::FileStatus stat(osl_FileStatus_Mask_Type); + if (osl::DirectoryItem::get(url, item) == osl::FileBase::E_None + && item.getFileStatus(stat) == osl::FileBase::E_None + && stat.getFileType() == osl::FileStatus::Directory) { - 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.userdata = url; aInfo.productname = aVersion; } - catch (const uno::Exception&) - { - } } ++i_ver; } |