[Fix #1011] Add pattern matching with Dir#[] for config.

But keep backwards compatibility and issue deprecation warnings for problematic patterns such as bare file names and patterns ending with `**`.