Path Management

Path management utilities for Simulchip.

This module provides centralized path generation and management for: - Collection files - Deck PDFs - Cache directories - Configuration files

simulchip.paths.get_default_collection_path()[source]

Get the default collection file path.

Return type:

Path

Returns:

Path to the default collection file (~/.simulchip/collection.toml)

simulchip.paths.get_default_cache_dir()[source]

Get the default cache directory path.

Return type:

Path

Returns:

Path to the default cache directory (~/.simulchip/cache)

simulchip.paths.get_deck_pdf_path(identity_title, deck_name, side, base_dir=None)[source]

Generate the standard path for a deck PDF.

Creates a path structure like: decks/(corporation|runner)/(identity-slug)/(deck-name).pdf

Parameters:
  • identity_title (str) – The identity card title (e.g., “Zahya Sadeghi: Versatile Smuggler”)

  • deck_name (str) – The deck name

  • side (str) – The side (“corp”, “corporation”, or “runner”)

  • base_dir (Optional[Path]) – Base directory for decks (defaults to ./decks)

Return type:

Path

Returns:

Path object for the deck PDF

Examples

>>> get_deck_pdf_path("Zahya Sadeghi: Versatile Smuggler", "My Deck", "runner")
PosixPath('decks/runner/zahya-sadeghi-versatile-smuggler/my-deck.pdf')
simulchip.paths.create_identity_slug(identity_title)[source]

Create a filesystem-safe slug from an identity title.

Parameters:

identity_title (str) – The identity card title

Return type:

str

Returns:

A filesystem-safe slug

Examples

>>> create_identity_slug("Zahya Sadeghi: Versatile Smuggler")
'zahya-sadeghi-versatile-smuggler'
>>> create_identity_slug("Haas-Bioroid: Engineering the Future")
'haas-bioroid-engineering-the-future'
simulchip.paths.ensure_path_exists(path)[source]

Ensure a path and its parent directories exist.

Parameters:

path (Path) – Path to create (if it’s a file, only parent dirs are created)

Return type:

None

simulchip.paths.get_cache_subdirectory(subdir)[source]

Get a subdirectory within the cache directory.

Parameters:

subdir (str) – Name of the subdirectory

Return type:

Path

Returns:

Path to the cache subdirectory

simulchip.paths.get_cache_locations()[source]

Get all potential cache directory locations.

Return type:

list[Path]

Returns:

List of paths where cache files might be stored

simulchip.paths.reset_simulchip_data(collection_path=None, reset_collection=True, reset_cache=True)[source]

Reset Simulchip data files.

Parameters:
  • collection_path (Optional[Path]) – Path to collection file (uses default if None)

  • reset_collection (bool) – Whether to reset the collection file

  • reset_cache (bool) – Whether to clear cache directories

Return type:

dict[str, list[str]]

Returns:

Dictionary with ‘removed’ and ‘errors’ lists describing what happened

simulchip.paths.generate_default_output_path(comparison_result)[source]

Generate default output path for a deck comparison result.

Parameters:

comparison_result (Any) – Deck comparison result with identity and decklist_name

Return type:

Path

Returns:

Path for the deck PDF