Fixes #318

This fixes reported bug #318, and makes generating controllers in command-line with subfolders right. It changes nothing in controller generation without subfolders.