|0.1.1||Nov 19, 2018|
|0.1.0||Oct 26, 2018|
#407 in Procedural macros
205 downloads per month
Used in 2 crates
Get the path separator for your OS
When you want to
include!(_) generated files, cargo will ask you to
put them in
$OUT_DIR. However, the "usual" way of
will fail on some windows systems, because they fail to understand the
/ path separator. This crate allows you to replace that with:
This will work on all operating systems. You can create paths starting with the
separator by prepending
/ to the
join_path!(/ "usr", "local", "lib");
Add this to your Cargo.toml:
pathsep = "0.1"
Then you can use
#[macro_use] extern crate pathsep; in your crate root. As of
Rust 1.30, you can also omit the
use pathsep::join_path; directly.
This code is licensed under the terms of the Apache License 2.0 or the MIT license, at your discretion.
A small macro that gives us the path separator of the target system
This can be used in conjunction with
concat!(..) to build paths.
#[macro_use] extern crate pathsep; include!(concat!(env!("OUT_DIR"), path_separator!(), "generated.rs"));
The same can be more succinctly written as:
#[macro_use] extern crate pathsep; include!(path_join!(env!("OUT_DIR"), "generated.rs"));