Skip to content

Commit 019c26e

Browse files
committed
manage the locales when the program is coming from crates.io
Closes: #8569
1 parent ee1b802 commit 019c26e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/uucore/build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ fn detect_target_utility() -> Option<String> {
7878
}
7979
}
8080

81+
// Auto-detect utility name from CARGO_PKG_NAME if it's a uu_* package
82+
if let Ok(pkg_name) = env::var("CARGO_PKG_NAME") {
83+
if let Some(util_name) = pkg_name.strip_prefix("uu_") {
84+
println!("cargo:warning=Auto-detected utility name: {}", util_name);
85+
return Some(util_name.to_string());
86+
}
87+
}
88+
8189
// Check for a build configuration file in the target directory
8290
if let Ok(target_dir) = env::var("CARGO_TARGET_DIR") {
8391
let config_path = std::path::Path::new(&target_dir).join("uucore_target_util.txt");

0 commit comments

Comments
 (0)