Pass the file to BuildCheck rather than using gDirectory