(
env_name: str,
default_relative: str,
paper: Optional[Dict[str, Any]] = None,
user_id: Optional[str] = None,
category: str = "",
)
| 196 | |
| 197 | |
| 198 | def _resolve_configured_dir( |
| 199 | env_name: str, |
| 200 | default_relative: str, |
| 201 | paper: Optional[Dict[str, Any]] = None, |
| 202 | user_id: Optional[str] = None, |
| 203 | category: str = "", |
| 204 | ) -> Path: |
| 205 | configured = os.environ.get(env_name, "").strip() |
| 206 | base_dir = Path(configured).expanduser() if configured else PROJECT_ROOT / default_relative |
| 207 | if not base_dir.is_absolute(): |
| 208 | base_dir = PROJECT_ROOT / base_dir |
| 209 | if user_id and not configured: |
| 210 | base_dir = role_utils.apply_output_scope( |
| 211 | base_dir, |
| 212 | user_id, |
| 213 | category=category, |
| 214 | project_root=PROJECT_ROOT, |
| 215 | ) |
| 216 | obsidian_dir = _obsidian_month_dir(base_dir, paper or {}, category) |
| 217 | if obsidian_dir is not None: |
| 218 | obsidian_dir.mkdir(parents=True, exist_ok=True) |
| 219 | return obsidian_dir.resolve() |
| 220 | if _env_flag("PAPERFLOW_STORAGE_MONTHLY_SUBDIR", default=True): |
| 221 | base_dir = base_dir / _month_folder_name(paper or {}) |
| 222 | base_dir.mkdir(parents=True, exist_ok=True) |
| 223 | return base_dir.resolve() |
| 224 | |
| 225 | |
| 226 | def _parse_publish_month(paper: Dict[str, Any]) -> datetime: |
no test coverage detected