fix: 包内同时有bin和cpp文件时,写入翻译报错

This commit is contained in:
octopus_yan 2024-12-16 13:08:30 +08:00
parent 5a9226901f
commit 5214485a36

View File

@ -146,6 +146,10 @@ public class PBOUtil {
return wordItems; return wordItems;
List<File> files = new ArrayList<>(FileUtils.listFiles(file, FILE_NAME_LIST, true)); List<File> files = new ArrayList<>(FileUtils.listFiles(file, FILE_NAME_LIST, true));
List<String> names = files.stream().map(File::getName).toList();
if(names.contains("config.bin") && names.contains("config.cpp")) {
files = files.stream().filter(item -> "config.cpp".equals(item.getName())).toList();
}
for (File item : files) { for (File item : files) {
wordItems.addAll(findWordByFile(item)); wordItems.addAll(findWordByFile(item));
} }