from pathlib import Path


def _parse_cache_directory(options):
    """Parse the location of the cache."""
    path = Path(options.get("cache_path", ".respy"))

    if not path.is_absolute():
        path = Path.cwd() / path

    if path.name != ".respy":
        path = path / ".respy"

    options["cache_path"] = path

    return options