1
0

build.rs 501 B

1234567891011121314
  1. use std::path::PathBuf;
  2. fn main() {
  3. // If the monaco editor folder doesn't exist, download it
  4. let monaco_path = PathBuf::from("monaco-editor-0.52.2");
  5. if monaco_path.exists() {
  6. return;
  7. }
  8. let url = "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.52.2.tgz";
  9. let bytes = reqwest::blocking::get(url).unwrap().bytes().unwrap();
  10. let mut archive = tar::Archive::new(flate2::read::GzDecoder::new(bytes.as_ref()));
  11. archive.unpack(&monaco_path).unwrap();
  12. }