-
Notifications
You must be signed in to change notification settings - Fork 279
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 mimetype to pclx files #1698
Conversation
Apparently fmemopen is not a thing on Windows. I will have to look at some alternate way of doing this on Windows. |
This makes it possible to do cross-platform writing of data to the zip archive without writing the data to the hard drive first. Currently this is used to write the special mimetype file, but without having looked into it, it could be useful for faster writing of the main xml file or even frame data already in memory (cached or dirty).
Alright, I fixed it with a different solution. Should be cross-platform now. |
Regarding the miniz changes, wouldn't it be better to apply these changes to the fork we have and then bump the version? https://github.com/pencil2d/miniz |
There are no changes to miniz here, only to the QMiniz wrapper which is not a part of that fork. I initially did it this way to make updating the library as simple as possible, but with some of the latter changes I did, it ended up being C++ specific, so it could not be done this way in the miniz library which is purely c-based. Looking at that fork, there doesn't seem to be any reason for us to use that anymore. There's only one different commit, which claims to change fopen_s for _wfopen_s. However, it doesn't actually appear to do that. Moreover, it appears that change has already been done upstream. |
🤦♂️ ah you're right, I failed to see that it was the wrapper you modified. I have no objections in that case 👍 |
I just realized the miniz source in https://github.com/pencil2d/miniz is not exactly the code we use in the mina repo (damn it that was my bad). I made two changes in our midified version:
As for what @scribblemaniac said, yes, the upstream has implemented the same thing in this PR as what I did. We should consider using the upstream implementation instead of ours. However, the PR is not in a released version yet. |
I have tested this PR and it works as expected. Going to merge. |
@chchwy Thanks for looking into that. |
This includes a special "mimetype" file at the beginning of the zip archive of pclx files containing the mime type used for pclx files. Many common zip-based file formats (epub, openraster, openoffice, krita, and more) use this specific approach to help distinguish their files from other zip files. This provides a unique file signature for pclx projects and allows them to be identified by other programs such as the "file" utility on linux, and possibly file association on other platforms as well. This should not impact the reading of project files in any way since the file is outside the data directory and in fact won't even appear in the temporary directory.