From: Ian Jackson Date: Sat, 29 May 2021 19:36:41 +0000 (+0100) Subject: config: Break out libexec closure X-Git-Tag: otter-0.7.0~229 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=131b739e4c44289db6308091cd4108b7694be761;p=otter.git config: Break out libexec closure Signed-off-by: Ian Jackson --- diff --git a/src/config.rs b/src/config.rs index ce97d696..336c1675 100644 --- a/src/config.rs +++ b/src/config.rs @@ -139,7 +139,6 @@ impl ServerConfigSpec { None => leaf.to_owned(), })) }; - let save_dir = defpath(save_dir, "save" ); let specs_dir = defpath(specs_dir, "specs" ); let command_socket = defpath(command_socket, "var/command.socket"); @@ -150,8 +149,10 @@ impl ServerConfigSpec { let bundled_sources = defpath(bundled_sources, "bundled-sources" ); const DEFAULT_LIBRARY_GLOB: &str = "library/*.toml"; - let usvg_bin = usvg_bin.unwrap_or_else( - || format!("{}/usvg", &libexec_dir)); + let libexec = |specd: Option, leaf: &str| -> String { + specd.unwrap_or_else(|| format!("{}/{}", &libexec_dir, leaf)) + }; + let usvg_bin = libexec(usvg_bin, "usvg"); let shapelibs = shapelibs.unwrap_or_else(||{ let glob = defpath(None, DEFAULT_LIBRARY_GLOB);