Skip to content

Cache

Resolves the shared FetchContent cache directory used by CMake-based platforms.

cache

Shared FetchContent cache directory resolution.

Provides an OS-appropriate cache path for CMake FetchContent downloads so that multiple gen-dsp projects can share a single copy of fetched SDKs.

get_cache_dir

get_cache_dir() -> Path

Return the OS-appropriate shared cache directory for FetchContent.

  • macOS: ~/Library/Caches/gen-dsp/fetchcontent/
  • Linux: $XDG_CACHE_HOME/gen-dsp/fetchcontent/ (defaults to ~/.cache/)
  • Windows: %LOCALAPPDATA%/gen-dsp/fetchcontent/

dir_size

dir_size(path: Path) -> int

Return the total size in bytes of all files under path (0 if absent).

Symlinks are not followed (only real file sizes are counted).

format_size

format_size(num_bytes: int) -> str

Format a byte count as a human-readable string (e.g. 1.2 GB).