[Libreoffice-commits] .: desktop/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Thu Mar 1 13:34:22 PST 2012


 desktop/source/app/app.cxx             |    3 ---
 desktop/source/app/userinstall.cxx     |    5 ++++-
 desktop/source/migration/migration.cxx |   17 ++++++++---------
 3 files changed, 12 insertions(+), 13 deletions(-)

New commits:
commit 76e0d695a41326a5583dbc9702e0ce3b8219b514
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 1 22:27:56 2012 +0100

    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.

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index e1bd1e0..61746be 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 6b1672d..7fe9729 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 4df893a..dd73e3a 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;
     }


More information about the Libreoffice-commits mailing list