add directory check to isSourceFile