[xbuild] Implement GetDirectoryNameOfFileAbove ()

The method looks for the given file starting at the given path and traverses
the directory tree up until the file is found or root is reached.