Skip to content

Commit f9718c3

Browse files
Add: images/始まりじゃないimage.datに対応
1 parent 05cd67e commit f9718c3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/icon_manager.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ impl IconManager {
6565
.map_err(|e| Error::ReadImageFailed(e.into()))?;
6666
{
6767
let mut images = zip_reader.file().entries().iter().enumerate();
68-
let icon = match images
69-
.find(|(_, x)| x.entry().filename().as_str().unwrap_or("") == "images/icon.png")
70-
{
68+
let icon = match images.find(|(_, x)| {
69+
let filename = x.entry().filename().as_str().unwrap_or("");
70+
71+
filename == "images/icon.png" || filename == "icon.png"
72+
}) {
7173
Some((icon, _)) => icon,
7274
None => return Err(Error::ReadImageFailed(anyhow!("Icon not found"))),
7375
};
@@ -152,7 +154,8 @@ impl IconManager {
152154
let image_index = match images.find(|(_, x)| {
153155
let name = x.entry().filename().as_str().unwrap_or("");
154156

155-
name.starts_with(&format!("images/{}/OpenEyes", emotion))
157+
(name.starts_with(&format!("images/{}/OpenEyes", emotion))
158+
|| name.starts_with(&format!("{}/OpenEyes", emotion)))
156159
&& name.split('/').last().and_then(|n| n.chars().nth(4)) == Some('0')
157160
}) {
158161
Some((i, _)) => i,

0 commit comments

Comments
 (0)