This keeps duplicate code to a minimum and also addresses the issue
where calling set_cachedirs() didn't canonicalize the passed-in paths.
This will come in more handy as we refactor some of these option setters
away.
Should the clean-up done to this function in PATCH 3/6 be in here
instead? This confused the hell out of me until I saw the next patch
and I'm not sure how the clean-up fits into the next patch.