From f0696592eb2bfe45c6c96725d9d917a8b6f90067 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 26 Sep 2020 17:10:40 +0100 Subject: [PATCH] library loading, fixes Signed-off-by: Ian Jackson --- server.toml | 2 ++ src/shapelib.rs | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/server.toml b/server.toml index 38a6401d..2339d31f 100644 --- a/server.toml +++ b/server.toml @@ -11,6 +11,8 @@ save_directory = "/home/rustcargo/Rustup/Game/server" template_dir = "/home/ian/Rustup/Game/server/templates" bundled_sources = "/home/rustcargo/Rustup/Game/server/target/bundled-sources" +shapelibs = [ "/home/ian/Rustup/Game/server/library/*.toml" ] + [log] global_level = 'debug' diff --git a/src/shapelib.rs b/src/shapelib.rs index 7e606c21..f58e882e 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -312,7 +312,7 @@ pub fn load1(l: &Explicit1) { } impl Config1 { - fn resolve(&self) -> Result>, LibraryLoadError> { + fn resolve(&self) -> Result>, LibraryLoadError> { use Config1::*; Ok(match self { Explicit(e) => Box::new(iter::once(e.clone())), @@ -361,9 +361,13 @@ impl Config1 { #[throws(LibraryLoadError)] pub fn load() { for l in &config().shapelibs { - for e in l.resolve()? { + let libs = l.resolve()?; + let n = libs.len(); + for e in libs { load1(&e)?; } + info!("loaded {} shape libraries from {:?}", n, &l); + } } @@ -422,7 +426,7 @@ impl TryFrom for FileList { let item_spec = n()?; let _r_file_spec = n()?; let desc = Html(n()?); - assert!(!n().is_err()); + assert!(n().is_err()); o.push(FileData{ item_spec, r_file_spec: (), desc }); } Ok(FileList(o)) -- 2.30.2