Author: calberto
Date: 2005-07-05 11:29:43 -0400 (Tue, 05 Jul 2005)
New Revision: 46947

Modified:
   trunk/mcs/tools/gacutil/ChangeLog
   trunk/mcs/tools/gacutil/driver.cs
Log:
2005-07-01  Carlos Alberto Cortez <[EMAIL PROTECTED]>

        * driver.cs (Install): Copy the linked resource files
        for the assembly when installing it.
        


Modified: trunk/mcs/tools/gacutil/ChangeLog
===================================================================
--- trunk/mcs/tools/gacutil/ChangeLog   2005-07-05 15:21:32 UTC (rev 46946)
+++ trunk/mcs/tools/gacutil/ChangeLog   2005-07-05 15:29:43 UTC (rev 46947)
@@ -1,3 +1,8 @@
+2005-07-01  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+       * driver.cs (Install): Copy the linked resource files
+       for the assembly when installing it.
+       
 2005-05-20  Ben Maurer  <[EMAIL PROTECTED]>
 
        * driver.cs (Main): If the switch argument isn't actually a

Modified: trunk/mcs/tools/gacutil/driver.cs
===================================================================
--- trunk/mcs/tools/gacutil/driver.cs   2005-07-05 15:21:32 UTC (rev 46946)
+++ trunk/mcs/tools/gacutil/driver.cs   2005-07-05 15:29:43 UTC (rev 46947)
@@ -193,28 +193,45 @@
                                string gacdir, string link_gacdir, string 
libdir, string link_libdir)
                {
                        string failure_msg = "Failure adding assembly to the 
cache: ";
+                       ArrayList resources;
 
                        if (!File.Exists (name)) {
                                WriteLine (failure_msg + "The system cannot 
find the file specified.");
                                Environment.Exit (1);
                        }
 
+                       Assembly assembly = null;
                        AssemblyName an = null;
                        byte [] pub_tok;
 
                        try {
-                               an = AssemblyName.GetAssemblyName (name);
+                               assembly = Assembly.LoadFrom (name);
                        } catch {
                                WriteLine (failure_msg + "The file specified is 
not a valid assembly.");
                                return false;
                        }
 
+                       an = assembly.GetName ();
                        pub_tok = an.GetPublicKeyToken ();
                        if (pub_tok == null || pub_tok.Length == 0) {
                                WriteLine (failure_msg + "Attempt to install an 
assembly without a strong name.");
                                return false;
                        }
 
+                       resources = new ArrayList ();
+                       foreach (string res_name in 
assembly.GetManifestResourceNames ()) {
+                               ManifestResourceInfo res_info = 
assembly.GetManifestResourceInfo (res_name);
+                               
+                               if ((res_info.ResourceLocation & 
ResourceLocation.Embedded) == 0) {
+                                       if (!File.Exists (res_info.FileName)) {
+                                               WriteLine (failure_msg + "The 
system cannot find resource " + res_info.FileName);
+                                               return false;
+                                       }
+
+                                       resources.Add (res_info);
+                               }
+                       }
+
                        if (check_refs && !CheckReferencedAssemblies (an)) {
                                WriteLine (failure_msg + "Attempt to install an 
assembly that references non " +
                                                "strong named assemblies with 
-check_refs enabled.");
@@ -250,6 +267,15 @@
                                        File.Copy (sibling, String.Concat 
(asmb_path, ext), true);
                        }
 
+                       foreach (ManifestResourceInfo resource_info in 
resources) {
+                               try {
+                                       File.Copy (resource_info.FileName, 
Path.Combine (full_path, Path.GetFileName (resource_info.FileName)), true);
+                               } catch {
+                                       WriteLine ("ERROR: Could not install 
resource file " + resource_info.FileName);
+                                       Environment.Exit (1);
+                               }
+                       }
+
                        if (package != null) {
                                string ref_dir = Path.Combine (libdir, package);
                                string ref_path = Path.Combine (ref_dir, 
asmb_file);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to