package config import ( "fmt" "path/filepath" "strings" ) // DefaultChunkPlanRoot resolves the existing per-user chunk-plan cache root. func DefaultChunkPlanRoot(userCacheDir func() (string, error)) (string, error) { if userCacheDir == nil { return "", fmt.Errorf("user cache directory resolver must not be nil") } root, err := userCacheDir() if err != nil { return "", fmt.Errorf("resolve user cache directory: %w", err) } root = strings.TrimSpace(root) if root == "" { return "", fmt.Errorf("user cache directory must not be empty") } return filepath.Join(filepath.Clean(root), "notarius", "chunk-plans"), nil }