From c98a6d59f4952dc205f02b45f02e3dce384ae850 Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Fri, 9 Jul 2021 20:43:33 -0400 Subject: [PATCH] Have build script create .env if not found --- build.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index dc485ae..dd98c99 100644 --- a/build.rs +++ b/build.rs @@ -34,7 +34,10 @@ fn main() -> Result<(), Box> { let mut path = PathBuf::from_str(&project_root)?; path.push(".env"); - let mut file = std::fs::OpenOptions::new().append(true).open(path)?; + let mut file = std::fs::OpenOptions::new() + .append(true) + .create(true) + .open(path)?; file.write_all(b"\nDATABASE_URL=sqlite:./cache/metadata.sqlite\n")?; file.sync_all()?; }