Pick files directly from the Fs in simulate_host

Previously, the list of all existing files was maintained separately, but
it was not updated when a guest created a file.
This commit is contained in:
Max Brunsfeld 2022-05-09 15:39:45 -07:00
parent 3d6db9083d
commit 2aec4ff234
2 changed files with 22 additions and 22 deletions

View file

@ -376,6 +376,16 @@ impl FakeFs {
.boxed()
}
pub async fn files(&self) -> Vec<PathBuf> {
self.state
.lock()
.await
.entries
.iter()
.filter_map(|(path, entry)| entry.content.as_ref().map(|_| path.clone()))
.collect()
}
async fn simulate_random_delay(&self) {
self.executor
.upgrade()