mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 07:25:47 +03:00
Detect when somebody accidentally copies multiple GeoJSON polygons into the importer.
This commit is contained in:
parent
077fef92de
commit
c6e4b6147f
@ -40,6 +40,16 @@ async fn main() -> Result<()> {
|
||||
let stdin = cmd.stdin.as_mut().unwrap();
|
||||
stdin.write_all(&geojson)?;
|
||||
assert!(cmd.wait()?.success());
|
||||
|
||||
if Path::new("boundary1.poly").exists() {
|
||||
abstio::delete_file("boundary0.poly");
|
||||
abstio::delete_file("boundary1.poly");
|
||||
// If there were more, leave them around, but at least delete these 2, so the user
|
||||
// can try again.
|
||||
anyhow::bail!(
|
||||
"Your GeoJSON contained multiple polygons. You can only import one at a time."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// What file should we download?
|
||||
|
Loading…
Reference in New Issue
Block a user