Expand description
Document-tree file-stem escaping and length truncation.
A Name projects onto a filename stem via Name::to_file_stem; file_stem
is the free-function form of that projection. escaped_path extends the
projection across a Path, joining each segment’s escaped stem with /.
A path that exceeds the filesystem’s length budget is shortened by
truncate_stem: it keeps a prefix of the escaped stem, trims a trailing
separator that the cut may have exposed, and appends a short content hash so
two names that share a long common prefix still truncate to distinct stems.
A budget too small to hold that hash and a character of the name is refused
rather than overrun — see MIN_TRUNCATED_STEM_BUDGET.
Constants§
- MIN_
TRUNCATED_ STEM_ BUDGET - The smallest
availablebudgettruncate_stemcan shorten a stem into.
Functions§
- escaped_
path - The escaped filesystem path
pathprojects onto, joining each segment’sfile_stemwith/. - file_
stem - The filename stem
nameprojects onto in a document tree. - is_
stem_ of - Whether
stemis the file stem of the name that escapes toescaped: the escaped stem itself, or a cuttruncate_stemcould have made of it under some budget. - truncate_
stem - Shorten an escaped stem to fit within
availablecharacters, orNonewhenavailableis belowMIN_TRUNCATED_STEM_BUDGET.