Skip to content

Commit

Permalink
get_all_models must collect vvm extension files
Browse files Browse the repository at this point in the history
  • Loading branch information
yamachu committed Aug 10, 2023
1 parent af59568 commit cb211f0
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions crates/voicevox_core/src/voice_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,16 @@ impl VoiceModel {
};

let mut vvm_paths = Vec::new();
for entry in root_dir.read_dir().map_err(|e| Error::LoadModel {
path: root_dir.clone(),
source: e.into(),
})? {
match entry {
Ok(entry) => vvm_paths.push(Self::from_path(entry.path())),
Err(e) => Err(Error::LoadModel {
path: root_dir.clone(),
source: e.into(),
})?,
}
for entry in root_dir
.read_dir()
.map_err(|e| Error::LoadModel {
path: root_dir.clone(),
source: e.into(),
})?
.filter_map(|v| v.ok())
.filter(|entry| entry.path().extension().map_or(false, |ext| ext == "vvm"))
{
vvm_paths.push(Self::from_path(entry.path()));
}

join_all(vvm_paths).await.into_iter().collect()
Expand Down

0 comments on commit cb211f0

Please sign in to comment.