Extend require dir function