MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _resolve_configured_dir

Function _resolve_configured_dir

agents/reading-agent/main.py:198–223  ·  view source on GitHub ↗
(
    env_name: str,
    default_relative: str,
    paper: Optional[Dict[str, Any]] = None,
    user_id: Optional[str] = None,
    category: str = "",
)

Source from the content-addressed store, hash-verified

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

Callers 2

_persist_pdf_fileFunction · 0.85

Calls 4

_obsidian_month_dirFunction · 0.85
_month_folder_nameFunction · 0.85
getMethod · 0.80
_env_flagFunction · 0.70

Tested by

no test coverage detected