Safety check for build and cache dirs