Fix handling --cfgdir

Fixes #1225
Merge from hexchat master