From ea1c1ff8973f0326266fa27e6a081b8acd0d306b Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 11 Mar 2024 20:28:34 +0000 Subject: [PATCH] util: err out on invalid manifest/meta --- hyprcursor-util/src/main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hyprcursor-util/src/main.cpp b/hyprcursor-util/src/main.cpp index 1dad6b1..03518d8 100644 --- a/hyprcursor-util/src/main.cpp +++ b/hyprcursor-util/src/main.cpp @@ -141,7 +141,9 @@ static std::optional createCursorThemeFromPath(const std::string& p manifest->addConfigValue("description", Hyprlang::STRING{""}); manifest->addConfigValue("version", Hyprlang::STRING{""}); manifest->commence(); - manifest->parse(); + const auto RESULT = manifest->parse(); + if (RESULT.error) + return "Manifest has errors: \n" + std::string{RESULT.getError()}; } catch (const char* err) { return "failed parsing manifest: " + std::string{err}; } const std::string THEMENAME = std::any_cast(manifest->getConfigValue("name")); @@ -173,7 +175,10 @@ static std::optional createCursorThemeFromPath(const std::string& p meta->registerHandler(::parseDefineSize, "define_size", {.allowFlags = false}); meta->registerHandler(::parseOverride, "define_override", {.allowFlags = false}); meta->commence(); - meta->parse(); + const auto RESULT = meta->parse(); + + if (RESULT.error) + return "meta.hl has errors: \n" + std::string{RESULT.getError()}; } catch (const char* err) { return "failed parsing meta (" + METAPATH + "): " + std::string{err}; } // check if we have at least one image.