Skip to content

Fix get_asset_paths not properly deleting empty folders (& recursive async functions)#12638

Merged
james7132 merged 2 commits intobevyengine:mainfrom
ArthurBrussee:async-recurse
Mar 23, 2024
Merged

Fix get_asset_paths not properly deleting empty folders (& recursive async functions)#12638
james7132 merged 2 commits intobevyengine:mainfrom
ArthurBrussee:async-recurse

Conversation

@ArthurBrussee
Copy link
Copy Markdown
Contributor

@ArthurBrussee ArthurBrussee commented Mar 22, 2024

Objective

get_asset_paths tries to check whether a folder is empty, and if so delete it. However rather than checking whether any subfolder contains files it checks whether all subfolders have files.

Also cleanup various BoxedFutures in async recursive functions like these, rust 1.77 now allows recursive async functions (albeit still by boxing), hurray! This is a followup to #12550 (sorta). More BoxedFuture stuff can be removed now that rust 1.77 is out, which can use async recursive functions! This is mainly just cleaner code wise - the recursion still boxes the future so not much to win there.

PR is mainly whitespace changes so do disable whitespace diffs for easier review.

Rust 1.77 now allows recursive async functions (albeit still by boxing), hurray!
@alice-i-cecile alice-i-cecile added A-Assets Load files from disk to use for things like images, models, and sounds C-Code-Quality A section of code that is hard to understand or change labels Mar 22, 2024
Copy link
Copy Markdown
Contributor

@bushrat011899 bushrat011899 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really clean! On review of the AssetProcessor::initialize method, I think you've stumbled across an error in the implementation of get_asset_paths. I've included my reasoning for believing this is an error, but it may require a second pair of eyes to confirm I haven't missed something.

@alice-i-cecile alice-i-cecile added the C-Bug An unexpected or incorrect behavior label Mar 22, 2024
@ArthurBrussee ArthurBrussee changed the title Use recursive async functions (rust 1.77) Fix get_asset_paths not properly deleting empty folders (& recursive async functions) Mar 22, 2024
@james7132 james7132 added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Mar 23, 2024
@james7132 james7132 added this pull request to the merge queue Mar 23, 2024
Merged via the queue into bevyengine:main with commit 34c8778 Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior C-Code-Quality A section of code that is hard to understand or change S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants