From c8f61c3963c98f0b17a3077b3a8e86e556614ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Thu, 7 Sep 2023 22:47:42 +0200 Subject: [PATCH] create imported asset directory if needed (#9716) # Objective - Related to #9715 - Example `asset_processing` logs the following error: ``` thread 'IO Task Pool (1)' panicked at 'Failed to initialize asset processor log. This cannot be recovered. Try restarting. If that doesn't work, try deleting processed asset folder. No such file or directory (os error 2)', crates/bevy_asset/src/processor/mod.rs:867:25 ``` ## Solution - Create the log directory if needed --------- Co-authored-by: Carter Anderson --- crates/bevy_asset/src/processor/log.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/bevy_asset/src/processor/log.rs b/crates/bevy_asset/src/processor/log.rs index febe712ed2a5e..0c1c3d93fbade 100644 --- a/crates/bevy_asset/src/processor/log.rs +++ b/crates/bevy_asset/src/processor/log.rs @@ -89,6 +89,10 @@ impl ProcessorTransactionLog { } } + if let Some(parent_folder) = path.parent() { + async_fs::create_dir_all(parent_folder).await?; + } + Ok(Self { log_file: File::create(path).await?, })