Expand description
helper methods for file system paths
Structs§
- Pathname
Find Options - configuration for filesystem search.
Mirrors Perl
LaTeXML::Util::Pathname::pathname_find’s named-arg options; kpsewhich-fallback is NOT one of them — that lives in higher-levelLaTeXML::Package::FindFile_aux, which callspathname_kpsewhichafterpathname_findreturns empty. Keep this struct directory-search-only for parity.
Enums§
- Kpathsea
Backend - Which kpathsea backend this process resolved. Reported by
kpathsea_backendso a host-resolution problem is diagnosable from the log instead of surfacing only as indistinguishable “can’t find file” errors.
Functions§
- absolute
- convert a (possibly relative) file path to an absolute one
- ambient_
kpsewhich_ version - The ambient
kpsewhich --versionbanner (full stdout), memoized for the process. It is a global property of the host TeX install, and several consumers read it — kpathsea backend selection (select_kpaths) and ambient-year detection (inlatexml_engine; the year-based latex-dump staleness check in turn consumes that detected year) — sokpsewhichis spawned at most once. ReturnsNoneif kpsewhich is absent or the call fails. - candidate_
pathnames - It’s presumably cheep to concatinate all the pathnames, relative to the cost of testing for files, and this simplifies overall.
- canonical
- Canonicalize a pathname by simplifying redundant separators,
.and..components. Matches Perl’s pathname_canonical from Pathname.pm. - clear_
kpsewhich_ memo - Clear the per-thread kpsewhich memo. Called at the start of every
conversion (prepare_session): the persistent (non-harness) cortex_worker
runs many papers per thread, and a cached cwd-relative MISS from paper A
(kpathsea’s path spec includes
.) would wrongly persist into paper B (PR_READINESS should-fix 12). - concat
- combine a directory and a base name into a full path
- cwd
- returns the current working directory
- directory
- obtain the directory portion of a pathname (via
Path::parent) Matches Perl’s pathname_directory. - extension
- obtain the extension portion of a pathname (via
Path::extension). Perl’spathname_typepreserves case; callers that need a lowercased form should apply.to_ascii_lowercase()themselves. - file_
name - transform to a canonical file name, via
Path::file_name - file_
stem - transform to a base name (via
Path::file_stem) Note: Perl’s pathname_name returns the stem without extension and without case change. - find
- find the requested
pathnameusing theoptionssearch configuration. Mirrors Perlpathname_find(LaTeXML/Util/Pathname.pm L376-392): directory search with strict-case match preferred, falling back to a case-insensitive directory scan. The fallback is required for arxiv papers shipping uppercase filenames (e.g.PASJ95.STYreferenced asPASJ95.sty) — Perl’s regex pair pushes both strict and/imatches and returns the strict ones if any exist, otherwise the case-insensitive matches. kpsewhich is the caller’s responsibility (seeLaTeXML::Package::FindFile_aux). - findall
- Find all matching files (like pathname_findall). Port of Perl’s pathname_findall($pathname, %options).
- is_
absolute - absolute paths start with the filesystem root - check if this is one
- is_
literaldata - checks if the path starts with the “literal:” protocol
- is_
nasty - check if pathname contains dangerous pieces
- is_raw
- Check whether a pathname is a raw TeX source or definition file. Perl: pathname_is_raw
- is_
reloadable - check whether a pathname is reloadable as a TeX definition
- is_url
- checks if the path is a conforming URL string
- kpathsea_
backend - The backend this process resolved, with a short reason. Forces the
KPSEinitialization so the answer is always the real one. - kpsewhich
- make
- Compose a pathname from dir, name, type components. Port of Perl’s pathname_make(%pieces).
- prewarm_
kpathsea - Force-initialize the kpathsea global state and warm up the per- format suffix tables.
- protocol
- Note that this returns ONLY recognized protocols!
- relative
- Make a pathname relative to a base directory. Port of Perl’s pathname_relative($pathname, $base).
- report_
unavailable_ kpathsea - search for a list of candidate names via the external
kpsewhichutility returning the first path that is found - split
- Split the pathname into components (dir,name,type). If pathname is absolute, dir starts with volume or ‘/’
- url_
split - Simple logic for splitting a URL into protocol://base/path