+2007-05-15 Igor Zelmanovich <igorz@mainsoft.com>
+
+ * WebConfigurationManager.cs:
+ make configurations hashtable case-insensitive.
+ * WebConfigurationHost.cs: for TARGET_J2EE only:
+ GetStreamName returns file path in right case, that make it works
+ on case-sensitive file system.
+
2007-05-15 Marek Habersack <mhabersack@novell.com>
* BuildProviderCollection.cs: refactoring - use
if (map == null)
#if TARGET_J2EE
+ {
+ // check META-INF/web.config exists
+ java.lang.ClassLoader cl = (java.lang.ClassLoader) AppDomain.CurrentDomain.GetData ("GH_ContextClassLoader");
+ if (cl == null)
+ return null;
+ java.net.URL url = cl.getResource ("META-INF/web.config");
+ if (url == null)
+ return null;
+
return "/META-INF/web.config";
+ }
#else
mdir = Path.GetDirectoryName (System.Runtime.InteropServices.RuntimeEnvironment.SystemConfigurationFile);
#endif
} else {
int i;
if (locationSubPath == null)
+ {
configPath = fullPath;
+ if (configPath.Length > 1)
+ configPath = VirtualPathUtility.RemoveTrailingSlash (configPath);
+ }
else
configPath = locationSubPath;
string GetWebConfigFileName (string dir)
{
+#if TARGET_J2EE
+ DirectoryInfo d = GetCaseSensitiveExistingDirectory (new DirectoryInfo (dir));
+ if (d == null)
+ return null;
+
+ FileInfo file = (FileInfo) FindByName ("web.config", d.GetFiles ("W*"));
+ if (file == null)
+ file = (FileInfo) FindByName ("web.config", d.GetFiles ("w*"));
+
+ if (file != null)
+ return file.FullName;
+#else
string[] filenames = new string[] {"Web.Config", "Web.config", "web.config" };
foreach (string fn in filenames) {
if (File.Exists (file))
return file;
}
-
+#endif
return null;
}
+#if TARGET_J2EE
+ static DirectoryInfo GetCaseSensitiveExistingDirectory (DirectoryInfo dir) {
+ if (dir.Exists)
+ return dir;
+
+ DirectoryInfo parent = GetCaseSensitiveExistingDirectory (dir.Parent);
+ if (parent == null)
+ return null;
+
+ return (DirectoryInfo) FindByName (dir.Name, parent.GetDirectories ());
+ }
+ static FileSystemInfo FindByName (string name, FileSystemInfo [] infos)
+ {
+ for (int i = 0; i < infos.Length; i++) {
+ if (String.Compare (name, infos [i].Name, StringComparison.OrdinalIgnoreCase) == 0)
+ return infos [i];
+ }
+ return null;
+ }
+#endif
public virtual bool IsAboveApplication (string configPath)
{
throw new NotImplementedException ();