From c80331dab09b3c44ebd124199008a9ea1346e9fb Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Wed, 29 Nov 2023 11:04:46 +0100 Subject: [PATCH 1/2] We need to actually flush the async File to ensure everything gets written. The `Drop` impl won't do it for us --- src/http_assets.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/http_assets.rs b/src/http_assets.rs index cc6c4cf..1feb6c7 100644 --- a/src/http_assets.rs +++ b/src/http_assets.rs @@ -76,7 +76,9 @@ impl AssetReader for HttpAssetReader { // Write asset to cache, but ensure only one HttpAssetReader writes at any given point in time if self.sync.write().unwrap().insert(cache_path.clone()) { async_fs::create_dir_all(cache_path.parent().unwrap()).await?; - File::create(&cache_path).await?.write_all(&bytes).await?; + let mut file = File::create(&cache_path).await?; + file.write_all(&bytes).await?; + file.flush().await?; } } Ok(Box::new(VecReader::new(bytes)) as Box>) From 6468b337f669c08e3e3c96f883195591d94d71f9 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Wed, 29 Nov 2023 11:26:12 +0100 Subject: [PATCH 2/2] Update bevy_web_asset repository to latest changes --- Cargo.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index bc8b19d..b7b06ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1282,10 +1282,11 @@ dependencies = [ [[package]] name = "bevy_web_asset" version = "0.7.1" -source = "git+https://github.com/oli-obk/bevy_web_asset.git?branch=android#938fbe7d39a88cad6a7648d84174dc14bf6ae729" +source = "git+https://github.com/oli-obk/bevy_web_asset.git?branch=android#dfe8f5b6e7bf1dbbde2c1a8a577f5a381c6a6e77" dependencies = [ "bevy", "js-sys", + "pin-project", "surf", "wasm-bindgen", "wasm-bindgen-futures",