#[macro_export]
macro_rules! gen_fs {
($root:ident => $f:ident $($tail:tt)*) => {
::std::fs::File::create($root.join(stringify!($f))).unwrap();
::efes::gen_fs!($root => $($tail)*);
};
($root:ident => ($dir:ident : $($inner:tt)*)$($tail:tt)*) => {
::std::fs::create_dir($root.join(stringify!($dir))).unwrap();
let $dir = $root.join(stringify!($dir));
::efes::gen_fs!($dir => $($inner)*);
::efes::gen_fs!($root => $($tail)*);
};
($root:ident => ) => {};
}
#[macro_export]
macro_rules! gen_paths {
($root:ident => $f:ident $($tail:tt)*) => {
{
#[allow(clippy::vec_init_then_push)]
{
let mut z_macro = Vec::new();
::efes::__gen_paths_private!(@$root | z_macro => $f $($tail)*);
z_macro
}
}
};
($root:ident => ($dir:ident : $($inner:tt)*)$($tail:tt)*) => {
{
#[allow(clippy::vec_init_then_push)]
{
let mut z_macro = Vec::new();
::efes::__gen_paths_private!(@$root | z_macro => ($dir : $($inner)*) $($tail)*);
z_macro
}
}
};
}
#[macro_export]
#[doc(hidden)]
macro_rules! __gen_paths_private {
(@$root:ident | $vec:ident => ) => {};
(@$root:ident | $vec:ident => $f:ident $($tail:tt)*) => {
$vec.push($root.join(stringify!($f)));
::efes::__gen_paths_private!(@$root | $vec => $($tail)*);
};
(@$root:ident | $vec:ident => ($dir:ident : $($inner:tt)*)$($tail:tt)*) => {
let $dir = $root.join(stringify!($dir));
::efes::__gen_paths_private!(@$dir | $vec => $($inner)*);
::efes::__gen_paths_private!(@$root | $vec => $($tail)*);
};
}