diff options
| author | vaxerski <vaxry@vaxry.net> | 2024-01-07 18:15:51 +0100 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2024-01-07 18:15:51 +0100 |
| commit | 9f2bde925bde09b4820a2cef369e9ddd930a746b (patch) | |
| tree | 54d33a02f7b3c52364bf6fb10a7c367df658967e /hyprpm/src/core/DataState.cpp | |
| parent | 7904188de9ca631436484cde733ef871f518d962 (diff) | |
hyprpm: handle failed compilations gracefully
Diffstat (limited to 'hyprpm/src/core/DataState.cpp')
| -rw-r--r-- | hyprpm/src/core/DataState.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/hyprpm/src/core/DataState.cpp b/hyprpm/src/core/DataState.cpp index d95f10bb..724c40ac 100644 --- a/hyprpm/src/core/DataState.cpp +++ b/hyprpm/src/core/DataState.cpp @@ -47,7 +47,8 @@ void DataState::addNewPluginRepo(const SPluginRepository& repo) { DATA.emplace(p.name, toml::table{ {"filename", p.name + ".so"}, - {"enabled", p.enabled} + {"enabled", p.enabled}, + {"failed", p.failed} }); } // clang-format on @@ -172,9 +173,10 @@ std::vector<SPluginRepository> DataState::getAllRepositories() { continue; const auto ENABLED = STATE[key]["enabled"].value_or(false); + const auto FAILED = STATE[key]["failed"].value_or(false); const auto FILENAME = STATE[key]["filename"].value_or(""); - repo.plugins.push_back(SPlugin{std::string{key.str()}, FILENAME, ENABLED}); + repo.plugins.push_back(SPlugin{std::string{key.str()}, FILENAME, ENABLED, FAILED}); } repos.push_back(repo); @@ -201,6 +203,11 @@ bool DataState::setPluginEnabled(const std::string& name, bool enabled) { if (key.str() != name) continue; + const auto FAILED = STATE[key]["failed"].value_or(false); + + if (FAILED) + return false; + (*STATE[key].as_table()).insert_or_assign("enabled", enabled); std::ofstream state(entry.path().string() + "/state.toml", std::ios::trunc); |
