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

  268 Reggie Burnett	2011-01-28
      now the active catalog is picked on the command line and only the first time through

    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 21:34:05 +0000
+++ b/WexInstaller/Core/ProductManager.cs	2011-01-28 20:11:34 +0000
@@ -83,21 +83,16 @@
 
             // Default to first catalog and then see if we have a catalog file
             // that gives us a different default
+            string defaultCatalog = GetDefaultCatalogIfAny();
             ActiveCatalog = manifest.ProductCatalogs[0];
-            string defaultCatalog = String.Format("{0}\\default.catalog",
-                InstallerConfiguration.HomeDir);
-            if (File.Exists(defaultCatalog))
+            if (defaultCatalog != null)
             {
-                using (StreamReader sr = new StreamReader(defaultCatalog))
-                {
-                    string catalogName = sr.ReadToEnd().Trim();
-                    foreach (ProductCatalog cat in manifest.ProductCatalogs)
-                        if (cat.Id == catalogName)
-                        {
-                            ActiveCatalog = cat;
-                            break;
-                        }
-                }
+                foreach (ProductCatalog cat in manifest.ProductCatalogs)
+                    if (cat.Id == defaultCatalog)
+                    {
+                        ActiveCatalog = cat;
+                        break;
+                    }
             }
 
             // setup the Installed and IsUpgrade global variables based
@@ -109,6 +104,16 @@
             }
         }
 
+        private static string GetDefaultCatalogIfAny()
+        {
+            // if ActiveCatalog != null, then this isn't the the first 
+            // time we have run so we always use default in that case
+            if (ActiveCatalog != null) return null;
+            string[] args = Environment.GetCommandLineArgs();
+            if (args.Length < 2) return null;
+            return args[1];   // this should be the default catalog name
+        }
+
         private static void LoadManifestWithCheckForTemp()
         {
             // first we need to see if there is any temp manifest file to check


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110128201134-vt67ojmd92401nhh.bundle
Thread
bzr commit into wex-installer-1.0 branch (reggie.burnett:268) Reggie Burnett28 Jan