""" Common utility for generating download destination paths. Used by both API mode and Sharing Link mode. """ import os from typing import Optional def get_download_destination_path( ge_id: str, lang: str, base_path: Optional[str] = None ) -> str: """ Generate destination path for downloads. Args: ge_id: GE ID (e.g., "11") lang: Language code (e.g., "us", "US", "de") - will be UPPERCASED base_path: Optional base path override. If None, uses nas_service.DESTINATION_PATH Returns: Full destination path (e.g., "\\172.16.14.240\\raw\\11_US\\") Examples: >>> get_download_destination_path("11", "us") "\\\\172.16.14.240\\\\raw\\\\11_US\\\\" >>> get_download_destination_path("1000", "de") "\\\\172.16.14.240\\\\raw\\\\1000_DE\\\\" >>> get_download_destination_path("42", "jp", "D:\\downloads") "D:\\\\downloads\\\\42_JP\\\\" """ if base_path is None: # Import here to avoid circular dependency from ..services import nas_service base_path = nas_service.DESTINATION_PATH # Always uppercase the lang code to match old behavior (1000_DE, not 1000_de) return os.path.join( base_path, f"{ge_id}_{lang.upper()}" )