-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Fix empty folder missing problem when zip files. #330
base: main
Are you sure you want to change the base?
Conversation
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.
Thank you for your contribution.
First, I'd prefer to have separate pull requests for unrelated changes.
About the empty dir handling of zip files. I think it's a good idea to add an option/parameter to let the user decide whether to include directory entries or not. Enabling it could be the default, since it's what most users would expect.
@lefou okay, let me separate this pull request to two. |
I'd like to do some "linting" works on #331 firstly. |
Let's just do the zip file changes, no need all the english grammar improvements and other random build config tweaks. |
os/src/ZipOps.scala
Outdated
finally fis.foreach(_.close()) | ||
} | ||
|
||
private def makeZipEntry0( | ||
sub: os.SubPath, | ||
path: String, |
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.
Why are we using String
here?
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.
Because treats a ZipEntry
as directory if its name ends with "/" characters.
Firstly I want to add end "/" character, but in os.Path
it's not valid.
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.
I know it's not a good way to implement, since it breaks the type check inside os.Path
, could you give me some advice ?
should I rewrite another method to handle folders such like makeZipFolderEntry0
?
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.
We should be able to keep the conversion to string and appending of /
inside makeZipEntry0
. is: Option
should already tell us whether it's a file or directory I think
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.
Done. But I'm afraid This might be a little slightly fragile assumption, since it's relied on
val fis = if (os.isFile(file)) Some(os.read.inputStream(file)) else None
856c749
to
1d1ff79
Compare
This reverts commit 4a02278.
Does format checking relies on OS system ?
In my local windows git bash environment
one is 6 but another one is 253. |
In CI Test
to simplify, |
@counter2015 yes adding a sort seems reasonable |
I found the test report depends on old commit, seems some weird caching issues in CI environment. For example.
for new test code
Maybe we should re-run the CI command ? |
Fix: #328