Speed up file_input directory list.

Avoids repeated calls to stat() by caching is_directory and is_visible in file_input.