mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-27 15:07:09 +01:00
Board materials: one mod's broken reskate-materials.json leaves only that mod out, not every mod's declared colours
Since the declarations were read from the applied catalogue, a file that could not be read or parsed threw out of the whole refresh, so no mod's declared inputs applied (from launch, or after a live apply). Each file is read on its own again: a broken one is logged with its mod and skipped, and only a failed read of item ownership keeps the previous set.
This commit is contained in:
1 parent
d6c8c709d4
commit
ee830586b7
1 file changed
+9
-2
@@ -138,11 +138,18 @@ DeclarationSet read_declarations(const std::vector<mods::DeclarationFileStamp>&
|
||||
auto sources = mods::read_item_sources_checked(signature[1].path);
|
||||
if (!sources) throw std::runtime_error("Item ownership could not be read; retaining previous declarations");
|
||||
result.sources = std::move(*sources);
|
||||
// A mod whose file cannot be read or parsed is left out on its own: the others' declarations stand.
|
||||
// (Read only when a file changed, so this is said once for each change.)
|
||||
for (std::size_t at = 2; at < signature.size(); ++at) {
|
||||
const auto& file = signature[at];
|
||||
if (!file.present) continue;
|
||||
auto read = mods::parse_material_declarations(file.owner, read_shared_text(file.path, 64 * 1024));
|
||||
std::move(read.begin(), read.end(), std::back_inserter(result.materials));
|
||||
try {
|
||||
auto read = mods::parse_material_declarations(file.owner, read_shared_text(file.path, 64 * 1024));
|
||||
std::move(read.begin(), read.end(), std::back_inserter(result.materials));
|
||||
} catch (const std::exception& failure) {
|
||||
logging::log(logging::Level::warning, logging::Channel::customization,
|
||||
"Board parameters: {}'s reskate-materials.json is left out: {}", file.owner, failure.what());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user