mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
langtool: improve insertion of missing sections (logging, empty line)
This commit is contained in:
parent
c1c5c6cb86
commit
4802e7810b
@ -111,6 +111,10 @@ impl IniFile {
|
||||
}
|
||||
}
|
||||
// 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());
|
||||
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.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(())
|
||||
@ -114,7 +118,8 @@ fn main() {
|
||||
let root = "../../assets/lang";
|
||||
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() {
|
||||
// Grab them all.
|
||||
|
Loading…
Reference in New Issue
Block a user