List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:January 24 2011 9:34pm
Subject:bzr commit into wex-installer-1.0 branch (reggie.burnett:264)
View as plain text  
#At file:///C:/Users/Reggie/work/wex/installer-updated/ based on revid:reggie.burnett@stripped

  264 Reggie Burnett	2011-01-24
      the product now uses the new setup path if no products in the default catalog are installed, rather than if any products are installed globally

    modified:
      WexInstaller/Core/ProductManager.cs
=== modified file 'WexInstaller/Core/ProductManager.cs'
=== modified file 'WexInstaller/Core/ProductManager.cs'
--- a/WexInstaller/Core/ProductManager.cs	2011-01-24 17:24:16 +0000
+++ b/WexInstaller/Core/ProductManager.cs	2011-01-24 21:34:05 +0000
@@ -68,8 +68,6 @@
                 foreach (Product p in pc.Products)
                 {
                     p.PostInitialize(true);
-                    ProductsInstalled |= p.Installed;
-                    ProductsUpgrade |= p.IsUpgrade;
                     p.SetParent(pc);
                 }
             }
@@ -86,17 +84,28 @@
             // Default to first catalog and then see if we have a catalog file
             // that gives us a different default
             ActiveCatalog = manifest.ProductCatalogs[0];
-            string[] files = Directory.GetFiles(InstallerConfiguration.HomeDir, "*.catalog");
-            if (files != null && files.Length == 1)
-            {
-                string fileName = Path.GetFileName(files[0]);
-                fileName = fileName.Substring(0, fileName.Length - ".catalog".Length);
-                foreach (ProductCatalog cat in manifest.ProductCatalogs)
-                    if (cat.Id == fileName)
-                    {
-                        ActiveCatalog = cat;
-                        break;
-                    }
+            string defaultCatalog = String.Format("{0}\\default.catalog",
+                InstallerConfiguration.HomeDir);
+            if (File.Exists(defaultCatalog))
+            {
+                using (StreamReader sr = new StreamReader(defaultCatalog))
+                {
+                    string catalogName = sr.ReadToEnd().Trim();
+                    foreach (ProductCatalog cat in manifest.ProductCatalogs)
+                        if (cat.Id == catalogName)
+                        {
+                            ActiveCatalog = cat;
+                            break;
+                        }
+                }
+            }
+
+            // setup the Installed and IsUpgrade global variables based
+            // on what from the active catalog is installed.
+            foreach (CatalogProduct cp in ActiveCatalog.Products)
+            {
+                ProductsInstalled |= cp.ReferencedProduct.Installed;
+                ProductsUpgrade |= cp.ReferencedProduct.IsUpgrade;
             }
         }
 


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110124213405-p31imx7ges4qpmzr.bundle
Thread
bzr commit into wex-installer-1.0 branch (reggie.burnett:264) Reggie Burnett24 Jan