Skip to content

Commit

Permalink
Better comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alanocallaghan committed Feb 19, 2024
1 parent 3a8bdcd commit 1180053
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/qupath/ext/instanseg/core/InstanSegModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ private void fetchModel() throws IOException {
}

private static void downloadAndUnzip(URL url, Path localDirectory) throws IOException {
// Open a connection to the URL
try (BufferedInputStream in = new BufferedInputStream(url.openStream())) {
String fileName = url.toString().substring(url.toString().lastIndexOf('/') + 1);
Path localFilePath = localDirectory.resolve(fileName);
Files.copy(in, localFilePath, StandardCopyOption.REPLACE_EXISTING);
// todo: option?
Path outdir = localDirectory.resolve(fileName.replace(".zip", ""));
unzip(localFilePath, outdir);
}
}

private static void unzip(Path zipFilePath, Path destDirectory) throws IOException {
if (!Files.exists(destDirectory)) {
Files.createDirectory(destDirectory); // todo: deal with this?
Files.createDirectory(destDirectory); // todo: check if existing? rename if so?
}
try (ZipFile zipFile = new ZipFile(String.valueOf(zipFilePath))) {
Enumeration<? extends ZipEntry> entries = zipFile.entries();
Expand Down

0 comments on commit 1180053

Please sign in to comment.