Add File.delete to CLI platform

This commit is contained in:
Richard Feldman 2022-09-12 10:03:35 -04:00
parent d5cc75907f
commit 81d11e4edd
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
3 changed files with 43 additions and 10 deletions

View file

@ -217,6 +217,16 @@ pub extern "C" fn roc_fx_fileReadBytes(path: &RocList<u8>) -> RocResult<RocList<
RocResult::ok(RocList::empty())
}
#[no_mangle]
pub extern "C" fn roc_fx_fileDelete(roc_path: &RocList<u8>) -> RocResult<(), ReadErr> {
match std::fs::remove_file(path_from_roc_path(roc_path)) {
Ok(()) => RocResult::ok(()),
Err(_) => {
todo!("Report a file write error");
}
}
}
#[no_mangle]
pub extern "C" fn roc_fx_sendRequest(roc_request: &glue::Request) -> glue::Response {
let mut builder = reqwest::blocking::ClientBuilder::new();