mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 17:36:05 -05:00
make index unzip async
This commit is contained in:
parent
ae048e48a9
commit
7c582f177f
1 changed files with 19 additions and 12 deletions
|
@ -318,19 +318,25 @@ void Index::Impl::downloadIndex() {
|
|||
return;
|
||||
}
|
||||
|
||||
// unzip new index
|
||||
auto unzip = file::Unzip::intoDir(targetFile, targetDir, true)
|
||||
.expect("Unable to unzip new index");
|
||||
if (!unzip) {
|
||||
IndexUpdateEvent(UpdateFailed(unzip.unwrapErr())).post();
|
||||
return;
|
||||
}
|
||||
std::thread([=, this]() {
|
||||
// unzip new index
|
||||
auto unzip = file::Unzip::intoDir(targetFile, targetDir, true)
|
||||
.expect("Unable to unzip new index");
|
||||
if (!unzip) {
|
||||
Loader::get()->queueInMainThread([unzip] {
|
||||
IndexUpdateEvent(UpdateFailed(unzip.unwrapErr())).post();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// remove the directory github adds to the root of the zip
|
||||
(void)flattenGithubRepo(targetDir);
|
||||
// remove the directory github adds to the root of the zip
|
||||
(void)flattenGithubRepo(targetDir);
|
||||
|
||||
// update index
|
||||
this->updateFromLocalTree();
|
||||
Loader::get()->queueInMainThread([this] {
|
||||
// update index
|
||||
this->updateFromLocalTree();
|
||||
});
|
||||
}).detach();
|
||||
})
|
||||
.expect([](std::string const& err) {
|
||||
IndexUpdateEvent(UpdateFailed(fmt::format("Error downloading: {}", err))).post();
|
||||
|
@ -448,7 +454,8 @@ void Index::update(bool force) {
|
|||
// update sources
|
||||
if (force) {
|
||||
m_impl->downloadIndex();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_impl->checkForUpdates();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue