mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
output to the correct location
This commit is contained in:
parent
02e6194073
commit
e67f1ff45f
|
@ -62,10 +62,11 @@ pub struct Frame2 {
|
|||
pub h: u32,
|
||||
}
|
||||
|
||||
pub fn generate_from_file(filename: &str) -> (Aseprite, DynamicImage) {
|
||||
pub fn generate_from_file(filename: &Path) -> (Aseprite, DynamicImage) {
|
||||
let out_dir = std::env::var("OUT_DIR").expect("Expected OUT_DIR");
|
||||
|
||||
let output_filename = Path::new(&out_dir).join(&*filename);
|
||||
let output_filename = Path::new(&out_dir).join(filename.file_name().unwrap());
|
||||
|
||||
let image_output = output_filename.with_extension("png");
|
||||
let json_output = output_filename.with_extension("json");
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ use proc_macro2::Literal;
|
|||
use syn::parse::Parser;
|
||||
use syn::{parse_macro_input, punctuated::Punctuated, LitStr};
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::{iter, path::Path, str};
|
||||
|
||||
use quote::{format_ident, quote, ToTokens};
|
||||
|
@ -97,16 +98,10 @@ pub fn include_aseprite_inner(input: TokenStream) -> TokenStream {
|
|||
|
||||
let root = std::env::var("CARGO_MANIFEST_DIR").expect("Failed to get cargo manifest dir");
|
||||
|
||||
let filenames: Vec<String> = parsed
|
||||
let filenames: Vec<PathBuf> = parsed
|
||||
.iter()
|
||||
.map(|s| s.value())
|
||||
.map(|s| {
|
||||
Path::new(&root)
|
||||
.join(&*s)
|
||||
.as_path()
|
||||
.to_string_lossy()
|
||||
.into_owned()
|
||||
})
|
||||
.map(|s| Path::new(&root).join(&*s))
|
||||
.collect();
|
||||
|
||||
for filename in filenames.iter() {
|
||||
|
@ -184,6 +179,7 @@ pub fn include_aseprite_inner(input: TokenStream) -> TokenStream {
|
|||
.flatten();
|
||||
|
||||
let include_paths = filenames.iter().map(|s| {
|
||||
let s = s.as_os_str().to_string_lossy();
|
||||
quote! {
|
||||
const _: &[u8] = include_bytes!(#s);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue