Browse Source

fix: longer original files are not overwritten

dev
Dnomd343 2 years ago
parent
commit
356757c2d4
  1. 2
      src/assets/src/ffi.rs

2
src/assets/src/ffi.rs

@ -70,7 +70,6 @@ pub async unsafe extern "C" fn asset_update(
debug!("Asset sources -> {:?}", sources); debug!("Asset sources -> {:?}", sources);
debug!("Asset target -> `{}`", file); debug!("Asset target -> `{}`", file);
// TODO: clear target file at first
match asset_fetch(&name, &sources).await { match asset_fetch(&name, &sources).await {
Some(data) => { Some(data) => {
let mut content = String::new(); let mut content = String::new();
@ -81,6 +80,7 @@ pub async unsafe extern "C" fn asset_update(
match OpenOptions::new() match OpenOptions::new()
.write(true) .write(true)
.create(true) .create(true)
.truncate(true)
.open(&file) { // open target file .open(&file) { // open target file
Ok(mut fp) => { Ok(mut fp) => {
match fp.write_all(content.as_ref()) { match fp.write_all(content.as_ref()) {

Loading…
Cancel
Save