summaryrefslogtreecommitdiff
path: root/hyprpm/src/core/DataState.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-02-01 19:38:43 +0000
committerGitHub <noreply@github.com>2024-02-01 19:38:43 +0000
commit3656045ad88717fbc079c1ebb44c6f7d2ed85cf2 (patch)
treeb87cfe0abe57dbdbcc0be5e401630404846de33f /hyprpm/src/core/DataState.cpp
parent15316aaa311ce27982d4df3c9514f042290853a3 (diff)
hyprpm: install headers locally (#4585)
* hyprpm: install headers locally * oopsie
Diffstat (limited to 'hyprpm/src/core/DataState.cpp')
-rw-r--r--hyprpm/src/core/DataState.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/hyprpm/src/core/DataState.cpp b/hyprpm/src/core/DataState.cpp
index 724c40ac..cf54ecc6 100644
--- a/hyprpm/src/core/DataState.cpp
+++ b/hyprpm/src/core/DataState.cpp
@@ -20,11 +20,18 @@ std::string DataState::getDataStatePath() {
return std::string{HOME} + "/.local/share/hyprpm";
}
+std::string DataState::getHeadersPath() {
+ return getDataStatePath() + "/headersRoot";
+}
+
void DataState::ensureStateStoreExists() {
const auto PATH = getDataStatePath();
if (!std::filesystem::exists(PATH))
std::filesystem::create_directories(PATH);
+
+ if (!std::filesystem::exists(getHeadersPath()))
+ std::filesystem::create_directories(getHeadersPath());
}
void DataState::addNewPluginRepo(const SPluginRepository& repo) {
@@ -64,7 +71,10 @@ bool DataState::pluginRepoExists(const std::string& urlOrName) {
const auto PATH = getDataStatePath();
for (const auto& entry : std::filesystem::directory_iterator(PATH)) {
- if (!entry.is_directory())
+ if (!entry.is_directory() || entry.path().stem() == "headersRoot")
+ continue;
+
+ if (!std::filesystem::exists(entry.path().string() + "/state.toml"))
continue;
auto STATE = toml::parse_file(entry.path().string() + "/state.toml");
@@ -85,7 +95,10 @@ void DataState::removePluginRepo(const std::string& urlOrName) {
const auto PATH = getDataStatePath();
for (const auto& entry : std::filesystem::directory_iterator(PATH)) {
- if (!entry.is_directory())
+ if (!entry.is_directory() || entry.path().stem() == "headersRoot")
+ continue;
+
+ if (!std::filesystem::exists(entry.path().string() + "/state.toml"))
continue;
auto STATE = toml::parse_file(entry.path().string() + "/state.toml");
@@ -154,7 +167,10 @@ std::vector<SPluginRepository> DataState::getAllRepositories() {
std::vector<SPluginRepository> repos;
for (const auto& entry : std::filesystem::directory_iterator(PATH)) {
- if (!entry.is_directory())
+ if (!entry.is_directory() || entry.path().stem() == "headersRoot")
+ continue;
+
+ if (!std::filesystem::exists(entry.path().string() + "/state.toml"))
continue;
auto STATE = toml::parse_file(entry.path().string() + "/state.toml");