Skip to content

Commit

Permalink
Remove the generated ctl10n macro before regeneration
Browse files Browse the repository at this point in the history
Otherwise, we may get a broken macro
  • Loading branch information
iovxw committed Jun 3, 2020
1 parent 61f4ebd commit 5db4548
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ fn main() {
println!("cargo:rerun-if-changed=locales/{}.toml", locale);
}
println!("cargo:rerun-if-env-changed=LOCALE");
if let Err(err) = ctl10n::convert_strings_file(
format!(
"locales/{}.toml",
&env::var("LOCALE").unwrap_or("zh".to_string())
),
Path::new(&env::var("OUT_DIR").unwrap()).join("ctl10n_macros.rs"),
) {
panic!("{}", err);
}
let locale_file = format!(
"locales/{}.toml",
&env::var("LOCALE").unwrap_or("zh".to_string())
);
let out_file = Path::new(&env::var("OUT_DIR").unwrap()).join("ctl10n_macros.rs");
let _ignore_error = std::fs::remove_file(&out_file);
ctl10n::convert_strings_file(locale_file, out_file).expect("ctl10n failed");
}

0 comments on commit 5db4548

Please sign in to comment.