Cleanup: rename file to dir in takeDirectory
Remove unnecessary `not . null` check

If `res` and `dir` are both null, it doesn't matter which one we return.
Refactor takeDirectory

Do not reimplement `dropTrailingPathSeparator`.
Merge pull request #20 from thomie/takeDirectory

Refactor takeDirectory