incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1364554 - /incubator/ooo/trunk/main/desktop/source/app/app.cxx
Date Mon, 23 Jul 2012 09:30:33 GMT
Author: af
Date: Mon Jul 23 09:30:33 2012
New Revision: 1364554

URL: http://svn.apache.org/viewvc?rev=1364554&view=rev
Log:
#i119206# Fixed up-to-date check of bundled extensions.

Modified:
    incubator/ooo/trunk/main/desktop/source/app/app.cxx

Modified: incubator/ooo/trunk/main/desktop/source/app/app.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/desktop/source/app/app.cxx?rev=1364554&r1=1364553&r2=1364554&view=diff
==============================================================================
--- incubator/ooo/trunk/main/desktop/source/app/app.cxx (original)
+++ incubator/ooo/trunk/main/desktop/source/app/app.cxx Mon Jul 23 09:30:33 2012
@@ -808,7 +808,7 @@ void MinimalCommandEnv::handle(
 */
 static bool needsInstallBundledExtensionBlobs (
     const ::rtl::OUString& rsMarkerURL,
-    ::osl::Directory& rDirectory)
+    const ::rtl::OUString& rsDirectoryURL)
 {
     ::osl::DirectoryItem aMarkerItem;
     if (::osl::DirectoryItem::get(rsMarkerURL, aMarkerItem) == ::osl::File::E_NOENT)
@@ -826,14 +826,18 @@ static bool needsInstallBundledExtension
 
     const TimeValue aMarkerModifyTime (aMarkerStat.getModifyTime());
 
-    if (rDirectory.open() != osl::File::E_None)
+    ::osl::Directory aDirectory (rsDirectoryURL);
+    if (aDirectory.open() != osl::File::E_None)
     {
         // No extension directory.  Nothing to be done.
         return false;
     }
 
+    // Check the date of each extension in the given directory.  If
+    // any of them is newer than the marker file then an installation
+    // is necessary.
     ::osl::DirectoryItem aDirectoryItem;
-    while (rDirectory.getNextItem(aDirectoryItem) == osl::File::E_None)
+    while (aDirectory.getNextItem(aDirectoryItem) == osl::File::E_None)
     {
         ::osl::FileStatus aFileStat (FileStatusMask_ModifyTime);
         if (aDirectoryItem.getFileStatus(aFileStat) != ::osl::File::E_None)
@@ -842,11 +846,30 @@ static bool needsInstallBundledExtension
             continue;
         if (aFileStat.getModifyTime().Seconds > aMarkerModifyTime.Seconds)
         {
-            rDirectory.close();
+            aDirectory.close();
             return true;
         }
 	}
-    rDirectory.close();
+    aDirectory.close();
+
+    // Also check the last modification time of the containing
+    // directory.  This ensures installation after an update of
+    // OpenOffice.  Without it the extensions have the date on which
+    // they where built, not the date on which they where installed.
+    if (::osl::DirectoryItem::get(rsDirectoryURL, aDirectoryItem) == osl::File::E_None)
+    {    
+        ::osl::FileStatus aDirectoryStat (FileStatusMask_ModifyTime);
+        const ::osl::FileBase::RC eResult (aDirectoryItem.getFileStatus(aDirectoryStat));
+        if (eResult == ::osl::File::E_None)
+        {
+            rtl_logfile_longTrace("|    checking last modification time of containing directory
%s\n", U2A(rsDirectoryURL));
+            if (aDirectoryStat.getModifyTime().Seconds > aMarkerModifyTime.Seconds)
+            {
+                rtl_logfile_longTrace("|        containing directory is newer than marker\n");
+                return true;
+            }
+        }
+    }
 
     // No file in the directory is newer than the marker.
     return false;
@@ -864,7 +887,7 @@ static void installBundledExtensionBlobs
     // than the marker we have to install any extension.
     ::rtl::OUString sMarkerURL (RTL_CONSTASCII_USTRINGPARAM("$BUNDLED_EXTENSIONS_USER/lastsynchronized.bundled"));
     ::rtl::Bootstrap::expandMacros(sMarkerURL);
-    if ( ! needsInstallBundledExtensionBlobs(sMarkerURL, aDir))
+    if ( ! needsInstallBundledExtensionBlobs(sMarkerURL, aDirUrl))
         return;
     writeLastModified(sMarkerURL);
 



Mime
View raw message