Qt: Add Clear and Reset buttons to cheat manager

This commit is contained in:
Connor McLaughlin
2021-02-12 00:20:04 +10:00
parent e75f1c1b6d
commit de688615ff
6 changed files with 119 additions and 17 deletions

View File

@ -607,10 +607,16 @@ CheatList::Format CheatList::DetectFileFormat(const std::string& str)
bool CheatList::LoadFromFile(const char* filename, Format format)
{
std::optional<std::string> str = FileSystem::ReadFileToString(filename);
if (!str.has_value() || str->empty())
if (!FileSystem::FileExists(filename))
return false;
std::optional<std::string> str = FileSystem::ReadFileToString(filename);
if (!str.has_value())
return false;
if (str->empty())
return true;
return LoadFromString(str.value(), format);
}