MCPcopy
hub / github.com/tickmao/Novel / resolve_legado_dir

Function resolve_legado_dir

scripts/legado_paths.py:13–31  ·  view source on GitHub ↗

解析 Legado 数据目录。 支持传入项目根目录或 `sources/legado` 目录。

(base_dir: Path | str | None = None)

Source from the content-addressed store, hash-verified

11
12
13def resolve_legado_dir(base_dir: Path | str | None = None) -> Path:
14 """
15 解析 Legado 数据目录。
16
17 支持传入项目根目录或 `sources/legado` 目录。
18 """
19 if base_dir is None:
20 base = Path(__file__).resolve().parent.parent
21 else:
22 base = Path(base_dir).resolve()
23
24 if (base / "main").is_dir() and (base / "pool").is_dir():
25 return base
26
27 legado_dir = base / "sources" / "legado"
28 if legado_dir.is_dir():
29 return legado_dir
30
31 return base
32
33
34def canonical_source_file(base_dir: Path | str | None = None) -> Path:

Callers 13

__init__Method · 0.90
__init__Method · 0.90
mainFunction · 0.90
mainFunction · 0.90
canonical_source_fileFunction · 0.85
working_source_fileFunction · 0.85
metadata_fileFunction · 0.85
screened_pool_fileFunction · 0.85
screened_report_fileFunction · 0.85
candidate_pool_fileFunction · 0.85
candidate_report_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected