Skip to content

Commit 16b0397

Browse files
committed
Initial revision
1 parent 90462c7 commit 16b0397

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "cautocfg"
3+
version = "0.1.0"
4+
edition = "2018"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]

src/lib.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
use std::fs::File;
3+
use std::io::LineWriter;
4+
5+
struct AutoCfg {
6+
config_dir: &str
7+
}
8+
9+
impl AutoCfg {
10+
11+
fn new() -> AutoCfg {
12+
AutoCfg {
13+
config_dir: ".",
14+
}
15+
}
16+
17+
fn write(&self) -> Result<()> {
18+
19+
let mut stream = File::create(self.config_dir);
20+
21+
let mut output = LineWriter::new(stream);
22+
23+
output.write_all("#define FOO_BAR_H 1\n");
24+
25+
output.write_all(format!("#define PACKAGE_NAME \"{}\"\n", "example"));
26+
27+
output.write_all(format!("#define VERSION \"{}\"\n", "1.0.0"));
28+
29+
let _status = output.flush();
30+
31+
Ok(())
32+
}
33+
34+
}

0 commit comments

Comments
 (0)