From 5ee9fda642b477fbabdd88daafdbd80726494544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bardon?= Date: Wed, 3 Jan 2024 15:05:23 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20localization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/helpers/src/generate.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/helpers/src/generate.rs b/src/helpers/src/generate.rs index 76b89d0..a018da2 100644 --- a/src/helpers/src/generate.rs +++ b/src/helpers/src/generate.rs @@ -145,24 +145,16 @@ fn _update_submodules() -> Result<(), Error> { fn _copy_hugo_config() -> Result<(), Error> { debug!("Copying hugo config…"); - // Create config dir - let config_dir = HUGO_CONFIG_DIR.join("_default"); - fs::create_dir_all(&config_dir).map_err(Error::CannotCreateHugoConfigFile)?; - debug!("Hugo config will be saved in <{}>", &config_dir.display()); - - // Read current config - let base_config = hugo(vec!["config"], true)?.stdout; - - // Write new config file - let config_file = config_dir.join("hugo.toml"); - let res = File::create(config_file) - .map_err(Error::CannotCreateHugoConfigFile)? - .write_all(&base_config) - .map_err(Error::CannotCreateHugoConfigFile)?; + // Copy config dir + // TODO: Support config that is not directory-based + let source = WEBSITE_ROOT.join("config"); + let dest = HUGO_CONFIG_DIR.join("_default"); + copy_directory(source.as_path(), dest.as_path()).map_err(Error::CannotCreateHugoConfigFile)?; + debug!("Hugo config will be saved in <{}>", &dest.display()); HUGO_CONFIG_GENERATED.store(true, Ordering::Relaxed); - Ok(res) + Ok(()) } fn gen_hugo_config(website_id: &WebsiteId) -> Result<(), Error> {