Skip to content

Commit 9dc7ca8

Browse files
committed
ModManager: Don't crash if the mods folder doesn't exist yet
1 parent e0844fc commit 9dc7ca8

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/modmanager.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,19 @@ ModManagerFrame::ModManagerFrame(wxWindow* parent, Launcher::Installation* Insta
215215
topSizer->Add(rightPanel, 1, wxEXPAND | wxALL, 5);
216216

217217
panel->SetSizer(topSizer);
218-
LoadModsFromFolder();
218+
219+
try {
220+
if (!fs::exists(_modspath)) {
221+
fs::create_directories(_modspath);
222+
}
223+
LoadModsFromFolder();
224+
} catch (fs::filesystem_error& err) {
225+
const wxString errMessage = wxString::Format("Failed to initialize/read mods folder: %s", err.what());
226+
wxMessageDialog(this, errMessage, "REPENTOGON Launcher", wxOK | wxICON_ERROR).ShowModal();
227+
Destroy();
228+
return;
229+
}
230+
219231
RefreshLists();
220232

221233
Bind(wxEVT_THREAD, &ModManagerFrame::OnThreadUpdate, this);

0 commit comments

Comments
 (0)