-
Notifications
You must be signed in to change notification settings - Fork 2
Fix zip parsing and add zipfile parsing test #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Relatedly, it'd be good to have better reporting from the unit tests here... Not obvious what's failing |
Not entirely sure I follow, but there is some weirdness around how zip files are handled generally - because there is a Zip File System Provider I'm less sure that looking relative to Adding to the fun, since the modularisation of Java you'll need to ensure that |
In theory, if there was a way to pass the filesystem to It's probably that there wrong type of filesystem is being create here: qupath-bioimageio-spec/src/main/java/qupath/bioimageio/spec/BioimageIoSpec.java Lines 210 to 218 in 1649e6f
but convincing Filesystems.newFileSystem to make a ZipFileSystem seems to be another story entirely. |
Actually, I spoke too soon. It is a zip file system, but we're not resolving paths within the zip. eg, changing the above quoted block to this: // Check zip file
var fs = FileSystems.newFileSystem(path, null);
System.out.println(fs.getClass());
for (var dir : fs.getRootDirectories()) {
for (var name : MODEL_NAMES) {
var p = dir.resolve(name);
System.out.println(p);
if (Files.exists(p))
return p;
}
} I get:
because This stackoverflow post suggests exactly this method, so it's not clear to me if/when something changed here. |
My mistake, the code was right, my zip files were wrong. Could merge this to test zip parsing, or not, doesn't matter much |
Going to can this, might be useful to automatically generate a zipfile then parse it but there's little utility in this |
I've broken zip parsing somehow which I guess demonstrates the utility of this PR |
7cc0008
to
b591b60
Compare
The javadocs claim we can parse models without unzipping, but as far as I can tell this is not the case (hence the broken unit test).
When parsing a zip, we try to resolve model names with respect to the root directory of the model zip. However for me this returns "/", so we're looking for files in the filesystem root and this will fail unless somebody's done something really strange.
This PR aims to fix parsing from zipped files without unzipping.