Implements Sandbox._ensure_directory()