1
Fork 0

Rollup merge of #138404 - bjorn3:sysroot_handling_cleanup, r=petrochenkov,jieyouxu

Cleanup sysroot locating a bit

All commits should preserve existing behavior.
This commit is contained in:
Matthias Krüger 2025-03-13 11:28:35 +01:00 committed by GitHub
commit ad23e9d705
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 42 additions and 51 deletions

View file

@ -106,8 +106,8 @@ impl From<Vec<FluentError>> for TranslationBundleError {
/// (overriding any conflicting messages).
#[instrument(level = "trace")]
pub fn fluent_bundle(
mut user_provided_sysroot: Option<PathBuf>,
mut sysroot_candidates: Vec<PathBuf>,
sysroot: PathBuf,
sysroot_candidates: Vec<PathBuf>,
requested_locale: Option<LanguageIdentifier>,
additional_ftl_path: Option<&Path>,
with_directionality_markers: bool,
@ -141,7 +141,7 @@ pub fn fluent_bundle(
// If the user requests the default locale then don't try to load anything.
if let Some(requested_locale) = requested_locale {
let mut found_resources = false;
for sysroot in user_provided_sysroot.iter_mut().chain(sysroot_candidates.iter_mut()) {
for mut sysroot in Some(sysroot).into_iter().chain(sysroot_candidates.into_iter()) {
sysroot.push("share");
sysroot.push("locale");
sysroot.push(requested_locale.to_string());