1
Fork 0
mirror of https://github.com/RGBCube/embd-rs synced 2025-07-26 21:17:44 +00:00

Fix relativity finally

This commit is contained in:
RGBCube 2024-01-04 13:40:05 +03:00
parent 41e02a9b3b
commit 9c39ac4a61
No known key found for this signature in database
3 changed files with 11 additions and 10 deletions

View file

@ -70,16 +70,22 @@ pub fn __include_dir(caller: &str, path: &str) -> Dir {
} }
#[macro_export] #[macro_export]
macro_rules! dir { macro_rules! __dir {
($path:literal) => {{ ($caller:literal, $path:literal) => {{
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
{ {
::embed::__include_dir(file!(), $path) ::embed::__include_dir($caller, $path)
} }
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]
{ {
::embed_macros::__include_dir!(file!(), $path) // FIXME ::embed_macros::__include_dir!($caller, $path)
// ::embed_macros::__include_dir!("embed/src/lib.rs", $path)
} }
}}; }};
} }
#[macro_export]
macro_rules! dir {
($path:literal) => {
::embed::__dir!(file!(), $path)
};
}

View file

@ -3,7 +3,3 @@ pub use dir::*;
mod file; mod file;
pub use file::*; pub use file::*;
// fn expand() {
// dir!(".")
// }

View file

@ -110,7 +110,6 @@ fn read_dir(base: &PathBuf, path: &PathBuf) -> Vec<TokenStream> {
entries.push(quote! { entries.push(quote! {
::embed::DirEntry(::embed::File { ::embed::DirEntry(::embed::File {
content: include_bytes!(#path_str), content: include_bytes!(#path_str),
// content: include_bytes(#path_str),
path: ::std::path::PathBuf::from(#path_str), path: ::std::path::PathBuf::from(#path_str),
}) })
}); });