Skip to content

Commit

Permalink
Fix unzip modify date & add verifying text
Browse files Browse the repository at this point in the history
  • Loading branch information
altalk23 committed Oct 2, 2023
1 parent 5c765c6 commit 0ed1a41
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
30 changes: 17 additions & 13 deletions loader/src/hooks/LoadingLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,24 @@ struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {
}

void setupLoaderResources() {
log::debug("Verifying Loader Resources");
this->setSmallText("Verifying Loader Resources");
// verify loader resources
if (!LoaderImpl::get()->verifyLoaderResources()) {
log::debug("Downloading Loader Resources");
this->setSmallText("Downloading Loader Resources");
this->addChild(EventListenerNode<ResourceDownloadFilter>::create(
this, &CustomLoadingLayer::updateResourcesProgress
));
}
else {
log::debug("Loading Loader Resources");
this->setSmallText("Loading Loader Resources");
LoaderImpl::get()->updateSpecialFiles();
this->continueLoadAssets();
}
Loader::get()->queueInMainThread([&]() {
if (!LoaderImpl::get()->verifyLoaderResources()) {
log::debug("Downloading Loader Resources");
this->setSmallText("Downloading Loader Resources");
this->addChild(EventListenerNode<ResourceDownloadFilter>::create(
this, &CustomLoadingLayer::updateResourcesProgress
));
}
else {
log::debug("Loading Loader Resources");
this->setSmallText("Loading Loader Resources");
LoaderImpl::get()->updateSpecialFiles();
this->continueLoadAssets();
}
});
}

void updateResourcesProgress(ResourceDownloadEvent* event) {
Expand Down
6 changes: 4 additions & 2 deletions loader/src/loader/ModImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,11 +596,13 @@ Result<> Mod::Impl::unzipGeodeFile(ModMetadata metadata) {
if (ec) {
return Err("Unable to delete temp dir: " + ec.message());
}


(void)utils::file::createDirectoryAll(tempDir);
auto res = file::writeString(datePath, modifiedHash);
if (!res) {
log::warn("Failed to write modified date of geode zip");
log::warn("Failed to write modified date of geode zip: {}", res.unwrapErr());
}


GEODE_UNWRAP_INTO(auto unzip, file::Unzip::create(metadata.getPath()));
if (!unzip.hasEntry(metadata.getBinaryName())) {
Expand Down

0 comments on commit 0ed1a41

Please sign in to comment.