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
Allow usage of external Listfile to rebuild MPQ. #36
Conversation
zach-cloud
commented
May 2, 2020
•
edited
edited
- By calling the addExternalListfile method, allows JMPQ3 to write archives that were missing (listfile)
- Refactored code that was going to be common between the addExternalListfile method and the internal readListfile
@@ -120,6 +120,8 @@ | |||
|
|||
/** If write operations are supported on the archive. */ | |||
private boolean canWrite; | |||
/** If the archive was originally read-only */ | |||
private boolean openedAsReadOnly; |
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 add this superfluous variable?
It also wouldn't sound right to open the mpq as read-only and for it then to become writable.
The listfile function should probably only be available in edit mode.
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.
It seems like the "edit mode" is only available in the Constructor. If the (listfile) doesn't exist, it sets canWrite to "false" even if it was originally not opened as read-only. That's why the setExternalListfile method needs to set canWrite to "true". However I don't want to set canWrite to "true" if the archive was orignally opened as readOnly. Does this make sense? Maybe there's a better way of accomplishing this.
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 pass listfile in constructor i suppose to prevent setting canWrite to false.
* Removes files from the listfile if they aren't | ||
* actually in the map. | ||
*/ | ||
private void removeMissingFiles() { |
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.
Seems to be equivalent to https://github.com/inwc3/JMPQ3/pull/36/files#diff-fb7d083bb9ea8eb0c5d21c0cc0059b5bR305 ?
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.
Yes, it is. Good point, that's a much better way of doing this.
Huh.. interesting that this was already in the code.. I swear it didn't work properly without adding in this removeMissingFIles method. I'll test again.
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.
Is it resolved?
Thanks for your contribution 😃 |
Ah, found why the test failed :) Fixed that. |
Status? |
Sorry for the delays. Been very busy lately. |
Sry for not merging, thanks for the contribution. |