43 lines
1.4 KiB
Rust
43 lines
1.4 KiB
Rust
// Copyright (C) 2021 "Maxime “pep” Buquet <pep@bouah.net>"
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify it
|
|
// under the terms of the GNU Affero General Public License as published by the
|
|
// Free Software Foundation, either version 3 of the License, or (at your
|
|
// option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
|
|
// for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
use std::fs::File;
|
|
use std::io::{BufWriter, Write};
|
|
use std::path::Path;
|
|
|
|
use quote::{format_ident, quote};
|
|
|
|
fn main() {
|
|
let output = Path::new(&env::var("OUT_DIR").unwrap()).join("output.rs");
|
|
let mut output = BufWriter::new(File::create(&output).unwrap());
|
|
|
|
let pkmn_names: Vec<_> = [
|
|
"Rhydon",
|
|
"Kangashkan",
|
|
"NidoranM",
|
|
].iter()
|
|
.map(|n| format_ident!("{}", n))
|
|
.collect();
|
|
|
|
let tokens = quote! {
|
|
/// Generated file containing various resources extracted from the provided ROM.
|
|
|
|
pub enum PokemonNames {
|
|
#(#pkmn_names),*
|
|
}
|
|
};
|
|
|
|
write!(output, "{}", tokens).unwrap();
|
|
}
|