From 356757c2d4bd9e578d71f0694dcad31d01aa3fe4 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Mon, 6 Mar 2023 19:58:47 +0800 Subject: [PATCH] fix: longer original files are not overwritten --- src/assets/src/ffi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/src/ffi.rs b/src/assets/src/ffi.rs index 0bbeed7..1512d9f 100644 --- a/src/assets/src/ffi.rs +++ b/src/assets/src/ffi.rs @@ -70,7 +70,6 @@ pub async unsafe extern "C" fn asset_update( debug!("Asset sources -> {:?}", sources); debug!("Asset target -> `{}`", file); - // TODO: clear target file at first match asset_fetch(&name, &sources).await { Some(data) => { let mut content = String::new(); @@ -81,6 +80,7 @@ pub async unsafe extern "C" fn asset_update( match OpenOptions::new() .write(true) .create(true) + .truncate(true) .open(&file) { // open target file Ok(mut fp) => { match fp.write_all(content.as_ref()) {