add zip file to classpath

Does anyone know how to add the contents of a zip file to the classpath using the OpenAPI? I am doing this for a jar file:

String binPath = PluginPomManager.unifyPath(getFileSystemPath(dep, null));
String binUrl = VirtualFileManager.constructUrl(JarFileSystem.PROTOCOL, binPath) + JarFileSystem.JAR_SEPARATOR;
VirtualFile binFile = VirtualFileManager.getInstance().findFileByUrl(binUrl);
libraryModel.addRoot(binFile, OrderRootType.CLASSES);

Is there something similar for a zip file? How does IDEA do it internally? If I add the file using the GUI, it puts it in the classpath and I can browse the contents similar to a jar.

Please sign in to leave a comment.