summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorXidorn Quan <github@upsuper.org>2016-12-12 13:48:58 -1000
committerGitHub <noreply@github.com>2016-12-12 13:48:58 -1000
commit3f711d85e72a4e4a516a8b128a9b212d8305b035 (patch)
treed8c3b1f1828f19a2b1d44cf878aa20ac51acd4ad /README.md
parent5d9c48e59b49135db1ecfd4ff8c3dbab8ed05086 (diff)
Fix issues in README
Mainly for fixing `env!("OUT_DIR")` usage in `build.rs`.
Diffstat (limited to 'README.md')
-rw-r--r--README.md8
1 files changed, 6 insertions, 2 deletions
diff --git a/README.md b/README.md
index 09f88db2..f25b815b 100644
--- a/README.md
+++ b/README.md
@@ -82,7 +82,7 @@ In `Cargo.toml`:
```toml
[package]
-...
+# ...
build = "build.rs"
[build-dependencies.libbindgen]
@@ -95,12 +95,16 @@ In `build.rs`:
```rust
extern crate libbindgen;
+use std::env;
+use std::path::Path;
+
fn main() {
+ let out_dir = env::var("OUT_DIR").unwrap();
let _ = libbindgen::builder()
.header("example.h")
.use_core()
.generate().unwrap()
- .write_to_file(concat!(env!("OUT_DIR"), "/example.rs"));
+ .write_to_file(Path::new(&out_dir).join("example.rs"));
}
```