Added realpath to dirname usages
Merge pull request #767 from bobvandevijver/dirname-v1.1

Added realpath to dirname usages
Duplicate fix #770 to correct branch