protected function getDefaultDirectory()
    {
        // Default to ~/.platformsh/.session, but if it's not writable, fall
        // back to the temporary directory.
        $default = $this->getHomeDirectory() . '/.platformsh/.session';
        if ($this->canWrite($default)) {
            return $default;
        }
        $temp = sys_get_temp_dir() . '/.platformsh-client/.session';
        if ($this->canWrite($temp)) {
            return $temp;
        }

        throw new \RuntimeException('Unable to find a writable session storage directory');
    }