mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 09:31:34 +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 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 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 image_output = output_filename.with_extension("png");
|
||||||
let json_output = output_filename.with_extension("json");
|
let json_output = output_filename.with_extension("json");
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ use proc_macro2::Literal;
|
||||||
use syn::parse::Parser;
|
use syn::parse::Parser;
|
||||||
use syn::{parse_macro_input, punctuated::Punctuated, LitStr};
|
use syn::{parse_macro_input, punctuated::Punctuated, LitStr};
|
||||||
|
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::{iter, path::Path, str};
|
use std::{iter, path::Path, str};
|
||||||
|
|
||||||
use quote::{format_ident, quote, ToTokens};
|
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 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()
|
.iter()
|
||||||
.map(|s| s.value())
|
.map(|s| s.value())
|
||||||
.map(|s| {
|
.map(|s| Path::new(&root).join(&*s))
|
||||||
Path::new(&root)
|
|
||||||
.join(&*s)
|
|
||||||
.as_path()
|
|
||||||
.to_string_lossy()
|
|
||||||
.into_owned()
|
|
||||||
})
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
for filename in filenames.iter() {
|
for filename in filenames.iter() {
|
||||||
|
@ -184,6 +179,7 @@ pub fn include_aseprite_inner(input: TokenStream) -> TokenStream {
|
||||||
.flatten();
|
.flatten();
|
||||||
|
|
||||||
let include_paths = filenames.iter().map(|s| {
|
let include_paths = filenames.iter().map(|s| {
|
||||||
|
let s = s.as_os_str().to_string_lossy();
|
||||||
quote! {
|
quote! {
|
||||||
const _: &[u8] = include_bytes!(#s);
|
const _: &[u8] = include_bytes!(#s);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue