Better way of determining cache directory