mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
edc97a0df2
When using `concat!` to join paths, the Unix path separator (`/`) is often used. This breaks on Windows if the base path is a verbatim path (i.e. starts with `\\?\`).
13 lines
484 B
Rust
13 lines
484 B
Rust
//! Include a file by concating the verbatim path using `/` instead of `\`
|
|
|
|
include!(concat!(env!("VERBATIM_DIR"), "/include/include.txt"));
|
|
fn main() {
|
|
assert_eq!(TEST, "Hello World!");
|
|
|
|
let s = include_str!(concat!(env!("VERBATIM_DIR"), "/include/include.txt"));
|
|
assert_eq!(s, "static TEST: &str = \"Hello World!\";\n");
|
|
|
|
let b = include_bytes!(concat!(env!("VERBATIM_DIR"), "/include/include.txt"));
|
|
assert_eq!(b, b"static TEST: &str = \"Hello World!\";\n");
|
|
}
|