Check and canonicalise directories properly.

Change-Id: I9d930b7d4cf93a6f7538fc9a76967f5dd53456c7
Fixes-Issue: CLIENT-489
Reviewed-on: http://gerrit.dmdirc.com/3337
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager