From 512bb4c358fa4a7fb4df42cec869942841d3b012 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 10 May 2025 19:00:17 -0400 Subject: [PATCH 1/2] Move changelog to root --- examples/changelog.md => changelog.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/changelog.md => changelog.md (100%) diff --git a/examples/changelog.md b/changelog.md similarity index 100% rename from examples/changelog.md rename to changelog.md From e5011b3d7219a4b4bb73139d317a8bd6a22524e0 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 10 May 2025 19:17:42 -0400 Subject: [PATCH 2/2] Quake map round-trip test example --- examples/map_roundtrip.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/map_roundtrip.rs diff --git a/examples/map_roundtrip.rs b/examples/map_roundtrip.rs new file mode 100644 index 0000000..c35893d --- /dev/null +++ b/examples/map_roundtrip.rs @@ -0,0 +1,32 @@ +#[cfg(feature = "std")] +fn main() { + use quake_util::qmap; + use std::env::args; + use std::io; + + let mut arguments = args(); + arguments.next(); + + let inpath = if let Some(path) = arguments.next() { + path + } else { + panic!("No input path"); + }; + + let outpath = if let Some(path) = arguments.next() { + path + } else { + panic!("No output path"); + }; + + let infile = std::fs::File::open(inpath).unwrap(); + let mut reader = io::BufReader::new(infile); + let map = qmap::parse(&mut reader).unwrap(); + + let outfile = std::fs::File::create(outpath).unwrap(); + let mut writer = io::BufWriter::new(outfile); + map.write_to(&mut writer).unwrap(); +} + +#[cfg(not(feature = "std"))] +fn main() {}