Skip to content

Commit

Permalink
Fix windows paths
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonbaeten committed Nov 11, 2024
1 parent 6f0e481 commit 693907d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions memory-serve-core/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ pub fn assets_to_code(asset_dir: &str, path: &Path, embed: bool, log: fn(&str))
let file_path = Path::new(&out_dir).join(file_name);
std::fs::write(&file_path, compressed_bytes).expect("Unable to write file to out dir.");

format!("Some(include_bytes!(\"{}\"))", file_path.to_string_lossy())
format!("Some(include_bytes!(r\"{}\"))", file_path.to_string_lossy())
} else {
format!("Some(include_bytes!(\"{}\"))", path.to_string_lossy())
format!("Some(include_bytes!(r\"{}\"))", path.to_string_lossy())
};

let is_compressed = compressed_bytes.is_some();

code.push_str(&format!(
"
memory_serve::Asset {{
route: \"{route}\",
path: {path:?},
route: r\"{route}\",
path: r{path:?},
content_type: \"{content_type}\",
etag: \"{etag}\",
bytes: {bytes},
Expand Down
3 changes: 1 addition & 2 deletions memory-serve-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ proc-macro = true
force-embed = []

[dependencies]
memory-serve-core = { path = "../memory-serve-core" }
proc-macro2 = "1.0"
memory-serve-core = { path = "../memory-serve-core" }
2 changes: 1 addition & 1 deletion memory-serve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ mod tests {
"text/html"
]
);
if cfg!(debug_assertions) {
if cfg!(debug_assertions) || cfg!(feature = "force-embed") {
assert_eq!(etags, ["", "", "", "", "", "", ""]);
} else {
assert_eq!(
Expand Down

0 comments on commit 693907d

Please sign in to comment.