1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#![feature(proc_macro_hygiene, decl_macro)]
use std::path::{Path};
use std::fs::create_dir;
pub fn api(base: &str) -> () {
let root_dir = env!("CARGO_MANIFEST_DIR").to_string();
let root = format!("{}{}{}", root_dir, "/src", base);
if !Path::exists(root.as_ref()) {
create_dir(root_dir.to_owned() + "/src" + &base).map_err(|err| -> String {
println!("Error creating root dir for api : {:?}", err);
"Error creating root dir for api".into()
});
}
}