From 5709d5ebbe1b9378fc81d9bef27184f5c649541c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 14 May 2022 14:53:01 +0100 Subject: [PATCH] otterlib: Initialise the nwtemplates Otherwise library items that depend on magical pieces that use these templates (eg, dice) don't work correctly. Signed-off-by: Ian Jackson --- Makefile | 4 +++- src/bin/otterlib.rs | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ee8cd157..c7094ccc 100644 --- a/Makefile +++ b/Makefile @@ -373,8 +373,10 @@ $(addprefix templates/,$(TXTFILES)): templates/%: %.txt libraries: $(LIBRARY_FILES) -templates/shapelib.html: $(TARGET_DIR)/debug/otterlib $(LIBRARY_FILES) +templates/shapelib.html: $(TARGET_DIR)/debug/otterlib $(LIBRARY_FILES) \ + $(NWTEMPLATEASSETS) $(NAILING_CARGO_JUST_RUN) $(abspath $<) \ + --nwtemplates $(abspath nwtemplates) \ --libs '$(addprefix $(PWD)/, $(addsuffix .toml, $(LIBRARIES)))' \ preview >$@.tmp && mv -f $@.tmp $@ diff --git a/src/bin/otterlib.rs b/src/bin/otterlib.rs index 51820650..fb05bb40 100644 --- a/src/bin/otterlib.rs +++ b/src/bin/otterlib.rs @@ -46,6 +46,9 @@ use structopt::StructOpt; #[derive(Debug,Clone)] #[derive(StructOpt)] pub struct Opts { + #[structopt(long="--nwtemplates", default_value="./nwtemplates")] + nwtemplates: String, + #[structopt(long="--libs", default_value="library/*.toml")] libs: String, @@ -82,6 +85,8 @@ fn preview(opts: &Opts, items: Vec) { const SEVERAL: usize = 3; let ig_dummy = Instance::dummy(); + nwtemplates::init_from_dir(&opts.nwtemplates)?; + impl Prep { fn want_several(&self) -> bool { self.size[0] < 50.0 -- 2.30.2