From 259ecfa098dfff0133401de51db43345d0e398a8 Mon Sep 17 00:00:00 2001 From: Maximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com> Date: Thu, 4 Jul 2024 18:04:41 +0200 Subject: [PATCH] string: respect removeEmpty when VarList input is empty (#7) --- include/hyprutils/string/VarList.hpp | 2 +- src/string/VarList.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/hyprutils/string/VarList.hpp b/include/hyprutils/string/VarList.hpp index a876111..697b51e 100644 --- a/include/hyprutils/string/VarList.hpp +++ b/include/hyprutils/string/VarList.hpp @@ -12,7 +12,7 @@ namespace Hyprutils { @param delim if delimiter is 's', use std::isspace @param removeEmpty remove empty args from argv */ - CVarList(const std::string& in, const size_t maxSize = 0, const char delim = ',', const bool removeEmpty = false); + CVarList(const std::string& in, const size_t lastArgNo = 0, const char delim = ',', const bool removeEmpty = false); ~CVarList() = default; diff --git a/src/string/VarList.cpp b/src/string/VarList.cpp index 0256087..925430c 100644 --- a/src/string/VarList.cpp +++ b/src/string/VarList.cpp @@ -6,7 +6,7 @@ using namespace Hyprutils::String; Hyprutils::String::CVarList::CVarList(const std::string& in, const size_t lastArgNo, const char delim, const bool removeEmpty) { - if (in.empty()) + if (!removeEmpty && in.empty()) m_vArgs.emplace_back(""); std::string args{in};