Crates.io | pathsep |
lib.rs | pathsep |
version | 0.1.1 |
source | src |
created_at | 2018-10-26 05:09:25.861505 |
updated_at | 2018-11-19 22:08:00.217221 |
description | a small macro to enable easy path construction in other macro calls |
homepage | |
repository | https://github.com/llogiq/pathsep |
max_upload_size | |
id | 92713 |
size | 16,791 |
When you want to include!(_)
generated files, cargo will ask you to
put them in $OUT_DIR
. However, the "usual" way of
include!(concat!(env!("OUT_DIR"), "/somefile.rs"));
will fail on some windows systems, because they fail to understand the
/
path separator. This crate allows you to replace that with:
include!(join_path!(env!("OUT_DIR"), "somefile.rs"));
This will work on all operating systems. You can create paths starting with the
separator by prepending /
to the join_path!
arguments:
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 #[macro_use]
and
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.