2009-01-26 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Mon, 26 Jan 2009 17:51:25 +0000 (17:51 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Mon, 26 Jan 2009 17:51:25 +0000 (17:51 -0000)
* BuildManagerDirectoryBuilder.cs: added support for fake virtual
paths.

svn path=/trunk/mcs/; revision=124536

mcs/class/System.Web/System.Web.Compilation/BuildManagerDirectoryBuilder.cs
mcs/class/System.Web/System.Web.Compilation/ChangeLog

index 98c15d84041afb847f7001300796bb0639a2509a..2cffe922c76ad99f8175f6db918e2de01e4c1317 100644 (file)
@@ -89,26 +89,29 @@ namespace System.Web.Compilation
                        }
                }
 
-               // TODO: add support for fake paths
                public List <BuildProviderGroup> Build (bool single)
                {
                        if (StrUtils.StartsWith (virtualPath.AppRelative, "~/App_Themes/")) {
-                               var ret = new List <BuildProviderGroup> ();
                                var themebp = new ThemeDirectoryBuildProvider ();
                                themebp.SetVirtualPath (virtualPath);
-
-                               var group = new BuildProviderGroup ();
-                               group.AddProvider (themebp);
-                               ret.Add (group);
                                
-                               return ret;
+                               return GetSingleBuildProviderGroup (themebp);
                        }
-                       
+
                        CompilationSection section = CompilationSection;
                        BuildProviderCollection bpcoll = section != null ? section.BuildProviders : null;
-                       
+
                        if (bpcoll == null || bpcoll.Count == 0)
                                return null;
+                       
+                       if (StrUtils.StartsWith (virtualPath.Original, BuildManager.FAKE_VIRTUAL_PATH_PREFIX)) {
+                               BuildProvider bp = GetBuildProvider (virtualPath.Original, bpcoll);
+
+                               if (bp == null)
+                                       return null;
+
+                               return GetSingleBuildProviderGroup (bp);
+                       }
 
                        if (single) {
                                AddVirtualFile (GetVirtualFile (virtualPath.Absolute), bpcoll);
@@ -206,7 +209,7 @@ namespace System.Web.Compilation
                                }
                        }
                }
-
+               
                void AddVirtualFile (VirtualFile file, BuildProviderCollection bpcoll)
                {
                        if (file == null || BuildManager.IgnoreVirtualPath (file.VirtualPath))
@@ -217,6 +220,16 @@ namespace System.Web.Compilation
                                return;
                        AddBuildProvider (bp);
                }
+
+               List <BuildProviderGroup> GetSingleBuildProviderGroup (BuildProvider bp)
+               {
+                       var ret = new List <BuildProviderGroup> ();
+                       var group = new BuildProviderGroup ();
+                       group.AddProvider (bp);
+                       ret.Add (group);
+
+                       return ret;
+               }
                
                VirtualDirectory GetVirtualDirectory (string virtualPath)
                {
index abcac7996fc94edea8cb3296ba58d7f111c80a60..ffaa8b5ccae99ec146c0ecbaa0c47d8298a76965 100644 (file)
@@ -1,5 +1,8 @@
 2009-01-26  Marek Habersack  <mhabersack@novell.com>
 
+       * BuildManagerDirectoryBuilder.cs: added support for fake virtual
+       paths.
+
        * CompilationException.cs: added a Message override to make error
        messages more useful.