-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add Zip support #310
base: main
Are you sure you want to change the base?
Add Zip support #310
Conversation
Resolves com-lihaoyi#161. Add Zip support. `os.zip(path)` to read/write zip file. File will be created if not exists. `zipFile / subPath` to get a path. Should be able to support all the file operations like copy, move, delete and so on.
Hi @lihaoyi , this is ready for review |
@wb14123 looks like a good start. Need a few more things according to the original ticket:
Below are the various flags on my OS-X laptop, I assume Linux zip has similar ones
We don't need to support all of them verbatim, but on a case by case basis:
Exactly which flag goes into which category is a subjective judgement. In terms of next steps, how about you go through the list of zip flags (either the ones I provided or the ones on your computer, doesn't really matter) and categorize them into the 4 categories above, and list out your categorization as part of the PR description. Then we can ensure that the ones that deserve special support are supported, and the ones that can be emulated via other workflows have those workflows tested and exercised. Lastly, we need to include this in the documentation. One you have the categorization/implementation/tests finalized, it should be pretty quick to copy paste the necessary parts of each into the |
import java.nio.file.{Path => _, _} | ||
import collection.JavaConverters._ | ||
|
||
class zip(zipPath: Path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since fs
is created internally, shouldn't the class zip
implement Closeable
?
|
||
private val fs = FileSystems.newFileSystem( | ||
URI.create("jar:file:" + zipPath.wrapped.toString), | ||
Map("create" -> "true").asJava |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could a Map[String, String]
be an optional parameter to the class constructor with this as the default value? That would make it configurable from the outside.
Resolves #161. Add Zip support.
os.zip(path)
to read/write zip file. File will be created if not exists.zipFile / subPath
to get a path. Should be able to support all the file operations like copy, move, delete and so on.