Fixing issue #2923 - Getting mode from file extension won't always work

Fixed issue #2923 Getting mode from file extension won't always work where some files don't have extensions like Makefiles for example.