[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.
looks little overcomplicated why not return here and avoid 2 additional GetDirectoryName calls on success (file exists)