Skip to content

Conversation

@Glavo
Copy link
Member

@Glavo Glavo commented Jan 6, 2026

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the file decompression logic in MinecraftInstanceTask to use kala-compress's ZipFileTree API instead of Java's FileSystem API. This change improves code consistency and leverages the existing ZipFileTree infrastructure.

  • Adds a getDirectory() method to ArchiveFileTree for retrieving directory nodes by path
  • Consolidates encoding detection logic by moving it from Unzipper to CompressingUtils
  • Refactors MinecraftInstanceTask to use ZipFileTree with a recursive approach for processing override files

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
ArchiveFileTree.java Adds getDirectory() method to navigate to specific directories in the archive tree
Unzipper.java Removes duplicate openReader() method, delegates to CompressingUtils for encoding detection
CompressingUtils.java Adds openZipFileWithPossibleEncoding() to centralize encoding detection logic, reorders methods for better organization
MinecraftInstanceTask.java Refactors from FileSystem to ZipFileTree API, implements recursive getOverrides() method for collecting file information

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +93 to +107
public @Nullable Dir<E> getDirectory(@NotNull String dirPath) {
Dir<E> dir = root;
if (dirPath.isEmpty()) {
return dir;
}
String[] path = dirPath.split("/");
for (String item : path) {
if (item.isEmpty())
continue;
dir = dir.getSubDirs().get(item);
if (dir == null)
return null;
}
return dir;
}
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newly added getDirectory method lacks test coverage. Since there is an existing test file ZipFileTreeTest.java for testing similar tree navigation functionality, consider adding test cases to verify this method handles various scenarios correctly, such as:

  • Finding an existing directory
  • Handling non-existent directories (should return null)
  • Handling empty path (should return root)
  • Handling paths with multiple levels
  • Handling paths with empty segments (consecutive slashes)

Copilot uses AI. Check for mistakes.
@Glavo Glavo merged commit 8b8a62c into HMCL-dev:main Jan 6, 2026
8 checks passed
@Glavo Glavo deleted the modpack branch January 6, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant