mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
langtool: improve insertion of missing sections (logging, empty line)
This commit is contained in:
parent
c1c5c6cb86
commit
4802e7810b
2 changed files with 10 additions and 1 deletions
|
@ -111,6 +111,10 @@ impl IniFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Reached the end for some reason? Add it.
|
// Reached the end for some reason? Add it.
|
||||||
|
// Also add an empty line to the previous section.
|
||||||
|
if let Some(last) = self.sections.last_mut() {
|
||||||
|
last.lines.push("".into());
|
||||||
|
}
|
||||||
self.sections.push(section.clone());
|
self.sections.push(section.clone());
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,10 @@ fn copy_missing_lines(reference_ini: &IniFile, target_ini: &mut IniFile) -> io::
|
||||||
//target_section.remove_lines_if_not_in(reference_section);
|
//target_section.remove_lines_if_not_in(reference_section);
|
||||||
target_section.comment_out_lines_if_not_in(reference_section);
|
target_section.comment_out_lines_if_not_in(reference_section);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Note: insert_section_if_missing will copy the entire section,
|
||||||
|
// no need to loop over the lines here.
|
||||||
|
println!("Inserted missing section: {}", reference_section.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -114,7 +118,8 @@ fn main() {
|
||||||
let root = "../../assets/lang";
|
let root = "../../assets/lang";
|
||||||
let reference_ini_filename = "en_US.ini";
|
let reference_ini_filename = "en_US.ini";
|
||||||
|
|
||||||
let mut reference_ini = IniFile::parse(&format!("{}/{}", root, reference_ini_filename)).unwrap();
|
let mut reference_ini =
|
||||||
|
IniFile::parse(&format!("{}/{}", root, reference_ini_filename)).unwrap();
|
||||||
|
|
||||||
if filenames.is_empty() {
|
if filenames.is_empty() {
|
||||||
// Grab them all.
|
// Grab them all.
|
||||||
|
|
Loading…
Add table
Reference in a new issue