Fix cache directory creation

`#mkdir_p` did not expand `~` correctly, so expand the path explicitly.

This should fix #1. Thanks @cupakromer.