update get buildDirectory config logic and fixed tests