Skip to content

Commit

Permalink
Properly check if MLC is writeable
Browse files Browse the repository at this point in the history
  • Loading branch information
Exzap committed Dec 7, 2024
1 parent 356cf0e commit 934cb54
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/gui/CemuApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ void CemuApp::InitializeExistingMLCOrFail(fs::path mlc)
g_config.Save();
}
}
else
{
// default path is not writeable. Just let the user know and quit. Unsure if it would be a good idea to ask the user to choose an alternative path instead
wxMessageBox(formatWxString(_("Cemu failed to write to the default mlc directory.\nThe path is:\n{}"), wxHelper::FromPath(mlc)), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
exit(0);
}
}

bool CemuApp::OnInit()
Expand Down Expand Up @@ -507,6 +513,13 @@ bool CemuApp::CreateDefaultMLCFiles(const fs::path& mlc)
file.flush();
file.close();
}
// create a dummy file in the mlc folder to check if it's writable
const auto dummyFile = fs::path(mlc).append("writetestdummy");
std::ofstream file(dummyFile);
if (!file.is_open())
return false;
file.close();
fs::remove(dummyFile);
}
catch (const std::exception& ex)
{
Expand Down

0 comments on commit 934cb54

Please sign in to comment.