Fix unzip modify date & add verifying text

This commit is contained in:
altalk23 2023-10-02 14:37:02 +03:00
parent 5c765c6798
commit 0ed1a41426
2 changed files with 21 additions and 15 deletions

View file

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

View file

@ -596,11 +596,13 @@ Result<> Mod::Impl::unzipGeodeFile(ModMetadata metadata) {
if (ec) { if (ec) {
return Err("Unable to delete temp dir: " + ec.message()); return Err("Unable to delete temp dir: " + ec.message());
} }
(void)utils::file::createDirectoryAll(tempDir);
auto res = file::writeString(datePath, modifiedHash); auto res = file::writeString(datePath, modifiedHash);
if (!res) { 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())); GEODE_UNWRAP_INTO(auto unzip, file::Unzip::create(metadata.getPath()));
if (!unzip.hasEntry(metadata.getBinaryName())) { if (!unzip.hasEntry(metadata.getBinaryName())) {