update pack.get_info

This commit is contained in:
MihailRis
2025-01-02 11:45:28 +03:00
parent e976b2078e
commit e2f6c263e7
3 changed files with 8 additions and 15 deletions
+5 -12
View File
@@ -81,25 +81,18 @@ static int l_pack_get_info(
lua::pushstring(L, pack.version);
lua::setfield(L, "version");
auto assets = engine->getAssets();
std::string icon = pack.id + ".icon";
if (engine->isHeadless()) {
if (fs::exists(pack.folder / fs::path("icon.png"))) {
icon = pack.folder.u8string() + "/icon.png";
} else {
icon = "gui/no_icon";
}
} else {
if (!engine->isHeadless()) {
auto assets = engine->getAssets();
std::string icon = pack.id + ".icon";
if (!AssetsLoader::loadExternalTexture(
assets, icon, {pack.folder / fs::path("icon.png")}
)) {
icon = "gui/no_icon";
}
lua::pushstring(L, icon);
lua::setfield(L, "icon");
}
lua::pushstring(L, icon);
lua::setfield(L, "icon");
if (!pack.dependencies.empty()) {
lua::createtable(L, pack.dependencies.size(), 0);
for (size_t i = 0; i < pack.dependencies.size(); i++) {