Initial public release of Warp.
Repo-Sync-Origin: warpdotdev/warp-internal@12af1d983b
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
use std::{env, fs, path::PathBuf};
|
||||
|
||||
fn main() {
|
||||
cargo_target_tmpdir();
|
||||
}
|
||||
|
||||
fn cargo_target_tmpdir() {
|
||||
let out_dir = env::var("OUT_DIR").expect("Build script should have out dir");
|
||||
let dest_path = PathBuf::from(&out_dir).join("cargo_target_tmpdir.rs");
|
||||
let tmp_path = match env::var("CARGO_TARGET_TMPDIR") {
|
||||
Ok(path) => PathBuf::from(path),
|
||||
Err(_) => PathBuf::from(out_dir).join("tmp/"),
|
||||
};
|
||||
fs::write(
|
||||
dest_path,
|
||||
format!(
|
||||
"pub mod cargo_target_tmpdir {{
|
||||
pub fn get() -> String {{
|
||||
r\"{}\".to_string()
|
||||
}}
|
||||
}}",
|
||||
tmp_path
|
||||
.to_str()
|
||||
.expect("Should be able to convert the path to a string")
|
||||
),
|
||||
)
|
||||
.expect("Could not write code snippet");
|
||||
}
|
||||
Reference in New Issue
Block a user