#include <AssetManager/AssetManager.hpp>
#include <EncyclopediaCategory/EncyclopediaArticle/EncyclopediaArticle.hpp>
#include <Utilities/Utilities.hpp>
#include <fstream>

bool EncyclopediaArticle::tryLoadPage(const std::string &pageName, std::ostream &os)
{
    std::string path = assets.resolve(formatString("encyclopedia/articles/$+.enc", pageName));
    std::ifstream ifs(path);
    if (!ifs.good())
    {
        return false;
    }

    os << ifs.rdbuf();
    return true;
}