Skip to content

Commit 4d6c173

Browse files
committed
add stale index files cleanup
1 parent 0969ec3 commit 4d6c173

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

loader/src/loader/LoaderImpl.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ void Loader::Impl::createDirectories() {
7474
}
7575
}
7676

77+
void Loader::Impl::removeDirectories() {
78+
// clean up of stale data from Geode v2
79+
if(std::filesystem::exists(dirs::getGeodeDir() / "index")) {
80+
std::thread([] {
81+
std::error_code ec;
82+
std::filesystem::remove_all(dirs::getGeodeDir() / "index", ec);
83+
}).detach();
84+
}
85+
}
86+
7787
Result<> Loader::Impl::setup() {
7888
if (m_isSetup) {
7989
return Ok();
@@ -105,6 +115,7 @@ Result<> Loader::Impl::setup() {
105115
{
106116
log::NestScope nest;
107117
this->createDirectories();
118+
this->removeDirectories();
108119
this->addSearchPaths();
109120
}
110121

loader/src/loader/LoaderImpl.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ namespace geode {
7979
~Impl();
8080

8181
void createDirectories();
82+
void removeDirectories();
8283

8384
void updateModResources(Mod* mod);
8485
void addSearchPaths();

0 commit comments

Comments
 (0)