diff --git a/crates/util_macros/src/util_macros.rs b/crates/util_macros/src/util_macros.rs index f79b1d6b550fd232759d3f596f8ae915cbc2c9c1..b30618354a216285c9003ebe0b0bf40b979ebb4a 100644 --- a/crates/util_macros/src/util_macros.rs +++ b/crates/util_macros/src/util_macros.rs @@ -24,19 +24,26 @@ use syn::{ #[proc_macro] pub fn path(input: TokenStream) -> TokenStream { let path = parse_macro_input!(input as LitStr); - let mut path = path.value(); #[cfg(target_os = "windows")] { + let mut path = path.value(); path = path.replace("/", "\\"); if path.starts_with("\\") { path = format!("C:{}", path); } + return TokenStream::from(quote! { + #path + }); } - TokenStream::from(quote! { - #path - }) + #[cfg(not(target_os = "windows"))] + { + let path = path.value(); + return TokenStream::from(quote! { + #path + }); + } } /// This macro replaces the path prefix `file:///` with `file:///C:/` for Windows.