Issue #2210533 by dnmurray: Properly pass directory by reference