Skip to content

Commit

Permalink
add stale index files cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Jan 14, 2025
1 parent 0969ec3 commit 4d6c173
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions loader/src/loader/LoaderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ void Loader::Impl::createDirectories() {
}
}

void Loader::Impl::removeDirectories() {
// clean up of stale data from Geode v2
if(std::filesystem::exists(dirs::getGeodeDir() / "index")) {
std::thread([] {
std::error_code ec;
std::filesystem::remove_all(dirs::getGeodeDir() / "index", ec);
}).detach();
}
}

Result<> Loader::Impl::setup() {
if (m_isSetup) {
return Ok();
Expand Down Expand Up @@ -105,6 +115,7 @@ Result<> Loader::Impl::setup() {
{
log::NestScope nest;
this->createDirectories();
this->removeDirectories();
this->addSearchPaths();
}

Expand Down
1 change: 1 addition & 0 deletions loader/src/loader/LoaderImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ namespace geode {
~Impl();

void createDirectories();
void removeDirectories();

void updateModResources(Mod* mod);
void addSearchPaths();
Expand Down

0 comments on commit 4d6c173

Please sign in to comment.