Multiple patch files

This commit is contained in:
JamesTheMaker 2024-03-06 12:40:38 -05:00
parent 79cd235939
commit f1e3f6791d

View File

@ -86,10 +86,21 @@ Assets::Assets(Settings settings, StringList assetSources) {
m_assetSourcePaths.add(sourcePath, source); m_assetSourcePaths.add(sourcePath, source);
for (auto const& filename : source->assetPaths()) { for (auto const& filename : source->assetPaths()) {
if (filename.contains(AssetsPatchSuffix, String::CaseInsensitive)) {
if (filename.endsWith(AssetsPatchSuffix, String::CaseInsensitive)) { if (filename.endsWith(AssetsPatchSuffix, String::CaseInsensitive)) {
auto targetPatchFile = filename.substr(0, filename.size() - strlen(AssetsPatchSuffix)); auto targetPatchFile = filename.substr(0, filename.size() - strlen(AssetsPatchSuffix));
if (auto p = m_files.ptr(targetPatchFile)) if (auto p = m_files.ptr(targetPatchFile))
p->patchSources.append({filename, source}); p->patchSources.append({filename, source});
} else {
for (int i = 0; i < 10; i++) {
if (filename.endsWith(AssetsPatchSuffix + toString(i), String::CaseInsensitive)) {
auto targetPatchFile = filename.substr(0, filename.size() - strlen(AssetsPatchSuffix) + 1);
if (auto p = m_files.ptr(targetPatchFile))
p->patchSources.append({filename, source});
break;
}
}
}
} }
auto& descriptor = m_files[filename]; auto& descriptor = m_files[filename];
descriptor.sourceName = filename; descriptor.sourceName = filename;