remove extra font file extension check

This commit is contained in:
MihailRis 2026-08-31 22:49:14 +03:00
parent 872b18fbe6
commit 873359fdd9

View file

@ -29,7 +29,6 @@
#include <array> #include <array>
#include <filesystem> #include <filesystem>
#include <iostream>
#include <stdexcept> #include <stdexcept>
static debug::Logger logger("assetload-funcs"); static debug::Logger logger("assetload-funcs");
@ -129,13 +128,15 @@ assetload::postfunc assetload::shader(
} }
assetload::postfunc assetload::posteffect( assetload::postfunc assetload::posteffect(
AssetsLoader&, AssetsLoader& loader,
const ResPaths& paths, const ResPaths& paths,
const std::string& file, const std::string& file,
const std::string& name, const std::string& name,
const std::shared_ptr<AssetCfg>& settings const std::shared_ptr<AssetCfg>& settings
) { ) {
io::path effectFile = paths.find(file + ".glsl"); io::path effectFile = paths.find(file + ".glsl");
loader.attachToFile(effectFile, {name, AssetType::POST_EFFECT});
std::string effectSource = io::read_string(effectFile); std::string effectSource = io::read_string(effectFile);
auto& preprocessor = *Shader::preprocessor; auto& preprocessor = *Shader::preprocessor;
@ -222,7 +223,7 @@ assetload::postfunc assetload::font(
) { ) {
auto cfg = std::dynamic_pointer_cast<FontCfg>(config); auto cfg = std::dynamic_pointer_cast<FontCfg>(config);
auto ext = fs::path(filename).extension().string(); auto ext = fs::path(filename).extension().string();
if (ext == ".ttf" || ext == ".otf") { if (!ext.empty()) {
logger.info() << "loading vector font " << util::quote(filename); logger.info() << "loading vector font " << util::quote(filename);
return [=](Assets& assets) { return [=](Assets& assets) {
using FontFile = vector_fonts::FontFile; using FontFile = vector_fonts::FontFile;
@ -402,7 +403,8 @@ static assetload::postfunc load_obj_model(
assets.store(std::unique_ptr<model::Model>(model), name); assets.store(std::unique_ptr<model::Model>(model), name);
}; };
} catch (const parsing_error& err) { } catch (const parsing_error& err) {
std::cerr << err.errorLog() << std::endl; logger.error() << "error on loading model " << name << ": "
<< err.errorLog();
throw; throw;
} }
} }
@ -457,7 +459,8 @@ static assetload::postfunc load_vcm_model(
); );
}; };
} catch (const parsing_error& err) { } catch (const parsing_error& err) {
std::cerr << err.errorLog() << std::endl; logger.error() << "error on loading model " << name << ": "
<< err.errorLog();
throw; throw;
} }
} }
@ -629,8 +632,7 @@ static bool load_animated_texture(
read_anim_file(animFile, frameList); read_anim_file(animFile, frameList);
} }
for (const auto& file : paths.listdir(animsDir + "/" + name)) { for (const auto& file : paths.listdir(animsDir + "/" + name)) {
if (!frameList.empty() && if (!frameList.empty() && !contains(frameList, file.stem())) {
!contains(frameList, file.stem())) {
continue; continue;
} }
if (!append_atlas(builder, file)) continue; if (!append_atlas(builder, file)) continue;