|
43 | 43 | import java.util.ArrayList; |
44 | 44 | import java.util.List; |
45 | 45 | import java.util.Map; |
46 | | -import java.util.Objects; |
47 | 46 |
|
48 | 47 | import static org.jackhuang.hmcl.util.Lang.mapOf; |
49 | 48 | import static org.jackhuang.hmcl.util.Pair.pair; |
@@ -93,9 +92,22 @@ private CheckBoxTreeItem<String> getTreeItem(Path file, String basePath) { |
93 | 92 | ModAdviser.ModSuggestion state = ModAdviser.ModSuggestion.SUGGESTED; |
94 | 93 | if (basePath.length() > "minecraft/".length()) { |
95 | 94 | state = adviser.advise(StringUtils.substringAfter(basePath, "minecraft/") + (isDirectory ? "/" : ""), isDirectory); |
96 | | - if (!isDirectory && Objects.equals(FileUtils.getNameWithoutExtension(file), version)) |
97 | | - state = ModAdviser.ModSuggestion.HIDDEN; |
98 | | - if (isDirectory && Objects.equals(FileUtils.getName(file), version + "-natives")) // Ignore <version>-natives |
| 95 | + |
| 96 | + String fileName = FileUtils.getName(file); |
| 97 | + |
| 98 | + if (!isDirectory) { |
| 99 | + switch (fileName) { |
| 100 | + case ".DS_Store", // macOS system file |
| 101 | + "desktop.ini", "Thumbs.db" // Windows system files |
| 102 | + -> state = ModAdviser.ModSuggestion.HIDDEN; |
| 103 | + } |
| 104 | + if (fileName.startsWith("._")) // macOS system file |
| 105 | + state = ModAdviser.ModSuggestion.HIDDEN; |
| 106 | + if (FileUtils.getNameWithoutExtension(file).equals(version)) |
| 107 | + state = ModAdviser.ModSuggestion.HIDDEN; |
| 108 | + } |
| 109 | + |
| 110 | + if (isDirectory && fileName.equals(version + "-natives")) // Ignore <version>-natives |
99 | 111 | state = ModAdviser.ModSuggestion.HIDDEN; |
100 | 112 | if (state == ModAdviser.ModSuggestion.HIDDEN) |
101 | 113 | return null; |
|
0 commit comments