fix: toml without exceptions usage
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
parent
e2a65a7077
commit
2a5d291bd9
@ -104,14 +104,15 @@ ModDetails ReadMCModTOML(QByteArray contents)
|
|||||||
#if TOML_EXCEPTIONS
|
#if TOML_EXCEPTIONS
|
||||||
try {
|
try {
|
||||||
tomlData = toml::parse(contents.toStdString());
|
tomlData = toml::parse(contents.toStdString());
|
||||||
} catch (const toml::parse_error& err) {
|
} catch ([[maybe_unused]] const toml::parse_error& err) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
tomlData = toml::parse(contents.toStdString());
|
toml::parse_result result = toml::parse(contents.toStdString());
|
||||||
if (!tomlData) {
|
if (!result) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
tomlData = result.table();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// array defined by [[mods]]
|
// array defined by [[mods]]
|
||||||
|
@ -241,12 +241,13 @@ auto V1::getIndexForMod(QDir& index_dir, QString slug) -> Mod
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
table = toml::parse_file(StringUtils::toStdString(index_dir.absoluteFilePath(real_fname)));
|
toml::parse_result result = toml::parse_file(StringUtils::toStdString(index_dir.absoluteFilePath(real_fname)));
|
||||||
if (!table) {
|
if (!result) {
|
||||||
qWarning() << QString("Could not open file %1!").arg(normalized_fname);
|
qWarning() << QString("Could not open file %1!").arg(normalized_fname);
|
||||||
qWarning() << "Reason: " << QString(table.error().what());
|
qWarning() << "Reason: " << result.error().description();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
table = result.table();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// index_file.close();
|
// index_file.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user