[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.
@marek-safar I wanted to avoid a `while (true)`, but I agree that getting rid of the additional calls is better. I pushed a new version, please have a look :)