From: Ian Jackson Date: Sat, 14 May 2022 13:53:01 +0000 (+0100) Subject: otterlib: Initialise the nwtemplates X-Git-Tag: otter-1.1.0~188 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=5709d5ebbe1b9378fc81d9bef27184f5c649541c;p=otter.git 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 --- 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