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
Identify zip file contents #576
Conversation
switch (type) { | ||
default: { | ||
auto res = Resource::compare(other, type); | ||
if (res.first != 0) | ||
return res; | ||
} | ||
case SortType::PACK_FORMAT: { | ||
auto this_ver = packFormat(); | ||
auto other_ver = cast_other.packFormat(); | ||
|
||
if (this_ver > other_ver) | ||
return { 1, type == SortType::PACK_FORMAT }; | ||
if (this_ver < other_ver) | ||
return { -1, type == SortType::PACK_FORMAT }; | ||
} | ||
} |
Check notice
Code scanning / CodeQL
No trivial switch statements
f78b742
to
2a739ec
Compare
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
moves the reading of mod files into `ModUtils` namespace Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
2a739ec
to
ebd905e
Compare
Ok, just added a simple validator for Shaderpacks. Only world saves left and then I can write a function to take a file name and tell you what it is if it is any of these things. I'm a little hung up on how to validate world saves There are two real questions:
The first is done to make extracting the save as easy as unpacking the archive to the minecraft folder while the second requires knowing to unpack to the I think this change is significant enough that code handling the world save would like to know beforehand without needing to check itself. Should it use a |
I agree that the name isn't the best, but that folder should really be called
I think you can make it a separate enum if you really think it would change a lot of the code. It would possibly be similar to ResourceType, but only for Worlds. However, I don't see how that'd be such a big thing in the code for parsing it. Wouldn't it just be a simple check like this?
|
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
ebd905e
to
db03845
Compare
Ok, all the new validators and tests are in place. taking off WIP for preliminary review. In order to truly close #349 I just have to add the check to the instance creation task after the files are downloaded |
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
3c05705
to
8422e3a
Compare
And... DONE! checked with these modpacks
|
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
validated that world saves are handled correctly via https://www.curseforge.com/minecraft/modpacks/mythcraft-revilo2 |
.. the build fails.... oh that is weird. in my machine somehow it knows how to convert QString to QFileInfo... OH! it's a qt 5 vs 6 thing |
fix: validatePath in validateZIPResouces Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
ok, fixed |
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.
sorry for the big amount of comment changes 😅
When you changed the process functions to return a bool
instead of void
, you also added checks to see if they returned the expected values. In principle, that's good, however maybe that's a bit too strict. For instance, suppose a resource pack doesn't have a pack.png
file. It is a valid state, since it will just use the default image on the game, but when you check its result, and returns false
from the entire processing of the resource pack, you make it so that the lack of an image is considered as a failure. Shouldn't that be changed, so that optional fields don't trigger this kind of failure?
otherwise the logic looks mostly fine, thanks
5fe5a94
to
bc0da56
Compare
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
bc0da56
to
3691f3a
Compare
ok, all cleaned up now. sorry for the mess. |
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.
ok, all cleaned up now. sorry for the mess.
don't worry about it, it's a lot of code to keep track off, some stuff inevitably slips by 🙂
i only have a single note here, otherwise this looks fine for me i think!
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
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.
(only noting the newlines :p)
this looks good to me, thank you!
Co-authored-by: flow <flowlnlnln@gmail.com> Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
any comment about this? As long as other metadata checks out, it probably shouldn't fail if |
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.
LGTM
they changed it already iirc, see here |
Oh I see, I misread that code 👀 |
Purpose
This PR will add support to identify zip archives (and in some cases bare folders) as containing:
pack.mcmeta
anddata
folder at the archive root.)class DataPack : public Resource
LocalDataPackParseTask
pack.mcmeta
andassets
folder at the archive root.)LocalResourcePackParseTask
pack.txt
at the archive root while not parsing as a resource pack.)LocalTexturePackParseTask
shaders
directory at the archive root)class ShaderPack : public Resource
LocalShaderPackParseTask
mcmod.info
\META-INF/mods.toml
or mod loader equivalent file at the archive root)bool validate(QFileInfo file)
function toLocalModParseTask
level.dat
)With this support it will also add check during instance creation to ensure zip files are placed appropriately.
Added as a draft for tracking and review purposes.
Related Issues
When complete this should fix #349.
Additional Info
will enable the creation of support for managing datapacks.