Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Bug? I had to replace "Path.Combine(head, dir)" with "dir" since Directory.GetDirectories already returns the full path. This caused a bug with paths like "..\SomeDir*.dll" since "..\" were duplicated by Combine Commented Mar 5, 2009 at 16:08
  • 1
    This doesn't seem to work if you pass a string like * to the Glob function. Are there some assumptions being made as to the sort of wildcard string it can handle? An absolute path maybe? Commented Sep 30, 2011 at 11:06
  • Method Glob splits the argument into two pieces at a DirSep. The code fails if there is no Dirsep. Adding the following statement to the beginning of method PathHead appears to work: if (! path.Contains(DirSep)) {return ".";}. Commented Jul 30, 2015 at 11:18
  • 1
    @Ben The assumption seems to be that the string contains a DirSep. With the change in my previous comment the code works for me. Commented Aug 17, 2015 at 9:29