+2009-01-26 Marek Habersack <mhabersack@novell.com>
+
+ * SearchPattern.cs: make IsMatch work for situations when there is
+ no wildcard in the pattern, but a subdirectory match is being
+ tested, e.g. pattern == "file.txt" and text ==
+ "subdir/file.txt". Lack of support for this has been causing
+ watching for changes to ASP.NET's web.config in subdirectories to
+ fail.
+
2008-11-06 Jonathan Chambers <joncham@gmail.com>
* MonoIO.cs : Add DuplicateHandle.
// so we need a overload in here for the Kqueue watcher
public bool IsMatch (string text, bool ignorecase)
{
- if (!hasWildcard)
- return (String.Compare (pattern, text, ignorecase) == 0);
-
+ if (!hasWildcard) {
+ bool match = String.Compare (pattern, text, ignorecase) == 0;
+ if (match)
+ return true;
+
+ // This is a special case for FSW. It needs to match e.g. subdir/file.txt
+ // when the pattern is "file.txt"
+ int idx = text.LastIndexOf ('/');
+ if (idx == -1)
+ return false;
+ idx++;
+ if (idx == text.Length)
+ return false;
+
+ return (String.Compare (pattern, text.Substring (idx), ignorecase) == 0);
+ }
+
return Match (ops, text, 0);
}