Modified the search directory function to understand system variables to allow the project to be more cross platform.