diff options
Diffstat (limited to 'crates/typst-cli/src/world.rs')
| -rw-r--r-- | crates/typst-cli/src/world.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/typst-cli/src/world.rs b/crates/typst-cli/src/world.rs index 500b64e5..81480e62 100644 --- a/crates/typst-cli/src/world.rs +++ b/crates/typst-cli/src/world.rs @@ -25,6 +25,8 @@ use crate::package::prepare_package; pub struct SystemWorld { /// The working directory. workdir: Option<PathBuf>, + /// The canonical path to the input file. + input: PathBuf, /// The root relative to which absolute paths are resolved. root: PathBuf, /// The input path. @@ -78,6 +80,7 @@ impl SystemWorld { Ok(Self { workdir: std::env::current_dir().ok(), + input, root, main: FileId::new(None, main_path), library: Prehashed::new(typst_library::build()), @@ -123,6 +126,11 @@ impl SystemWorld { self.now.take(); } + /// Return the canonical path to the input file. + pub fn input(&self) -> &PathBuf { + &self.input + } + /// Lookup a source file by id. #[track_caller] pub fn lookup(&self, id: FileId) -> Source { |
