mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-06 17:59:11 +00:00
add chinese help message
This commit is contained in:
@@ -86,6 +86,45 @@ impl WindowsBuild {
|
||||
}
|
||||
}
|
||||
|
||||
fn workdir() -> Option<String> {
|
||||
if let Ok(cargo_manifest_dir) = std::env::var("CARGO_MANIFEST_DIR") {
|
||||
return Some(cargo_manifest_dir);
|
||||
}
|
||||
|
||||
let dest = std::env::var("OUT_DIR");
|
||||
if dest.is_err() {
|
||||
return None;
|
||||
}
|
||||
let dest = dest.unwrap();
|
||||
|
||||
let seperator = regex::Regex::new(r"(/target/(.+?)/build/)|(\\target\\(.+?)\\build\\)")
|
||||
.expect("Invalid regex");
|
||||
let parts = seperator.split(dest.as_str()).collect::<Vec<_>>();
|
||||
|
||||
if parts.len() >= 2 {
|
||||
return Some(parts[0].to_string());
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
fn check_locale() {
|
||||
let workdir = workdir().unwrap_or("./".to_string());
|
||||
|
||||
let locale_path = format!("{workdir}/**/locales/**/*");
|
||||
if let Ok(globs) = globwalk::glob(locale_path) {
|
||||
for entry in globs {
|
||||
if let Err(e) = entry {
|
||||
println!("cargo:i18n-error={}", e);
|
||||
continue;
|
||||
}
|
||||
|
||||
let entry = entry.unwrap().into_path();
|
||||
println!("cargo:rerun-if-changed={}", entry.display());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
#[cfg(target_os = "windows")]
|
||||
WindowsBuild::check_for_win();
|
||||
@@ -98,5 +137,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.compile(&["proto/cli.proto"], &["proto/"])
|
||||
.unwrap();
|
||||
// tonic_build::compile_protos("proto/cli.proto")?;
|
||||
check_locale();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user