aboutsummaryrefslogtreecommitdiffhomepage
path: root/hyprpm
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-12-21 22:01:50 +0100
committervaxerski <[email protected]>2023-12-21 22:01:55 +0100
commit698f3b65765fc4b0cae0592f65663c70e593898d (patch)
tree2f745937ecce59a7bb08832e369d5b72b51dc4e3 /hyprpm
parent79f3888b4bd9796850189ed3e151a6c831e6faae (diff)
downloadHyprland-698f3b65765fc4b0cae0592f65663c70e593898d.tar.gz
Hyprland-698f3b65765fc4b0cae0592f65663c70e593898d.zip
hyprpm: trim paths in PATH
fixes #4210
Diffstat (limited to 'hyprpm')
-rw-r--r--hyprpm/src/core/PluginManager.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/hyprpm/src/core/PluginManager.cpp b/hyprpm/src/core/PluginManager.cpp
index c69533ee..e28637fd 100644
--- a/hyprpm/src/core/PluginManager.cpp
+++ b/hyprpm/src/core/PluginManager.cpp
@@ -13,7 +13,26 @@
#include <toml++/toml.hpp>
-std::string execAndGet(std::string cmd) {
+static std::string removeBeginEndSpacesTabs(std::string str) {
+ if (str.empty())
+ return str;
+
+ int countBefore = 0;
+ while (str[countBefore] == ' ' || str[countBefore] == '\t') {
+ countBefore++;
+ }
+
+ int countAfter = 0;
+ while ((int)str.length() - countAfter - 1 >= 0 && (str[str.length() - countAfter - 1] == ' ' || str[str.length() - 1 - countAfter] == '\t')) {
+ countAfter++;
+ }
+
+ str = str.substr(countBefore, str.length() - countBefore - countAfter);
+
+ return str;
+}
+
+static std::string execAndGet(std::string cmd) {
cmd += " 2>&1";
std::array<char, 128> buffer;
std::string result;
@@ -265,7 +284,7 @@ eHeadersErrors CPluginManager::headersValid() {
if (PATH.ends_with("protocols") || PATH.ends_with("wlroots"))
continue;
- verHeader = PATH.substr(2) + "/hyprland/src/version.h";
+ verHeader = removeBeginEndSpacesTabs(PATH.substr(2)) + "/hyprland/src/version.h";
break;
}