summaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/util.h b/src/util.h
index af5bbd6..38d89f2 100644
--- a/src/util.h
+++ b/src/util.h
@@ -9,10 +9,9 @@
#include <filesystem>
#include <cstdlib>
-std::string to_lower(const std::string& str);
+std::string to_lower(std::string str);
std::string readFile(const std::string& fileName);
-std::vector<std::string> readDeps(const std::string& depFile);
ctor::language languageFromExtension(const std::filesystem::path& file);
std::string cleanUp(const std::string& path);
@@ -24,8 +23,19 @@ void append(T& a, const T& b)
std::string esc(const std::string& in);
-std::vector<std::string> get_paths(const std::string& path_env = std::getenv("PATH"));
+//! Get system paths (ie. env var PATH).
+//! If path_env is provided, this search string will be used, other the PATH
+//! env variable is used.
+//! \returns a vector of the individual toknized paths.
+std::vector<std::string> get_paths(const std::string& path_env = {});
std::string locate(const std::string& app,
const std::vector<std::string>& paths,
const std::string& arch = {});
+
+//! Splits string into tokens adhering to quotations " and '
+std::vector<std::string> argsplit(const std::string& str);
+
+//! Calls the system getenv and sets the string if the env name it exists.
+//! \returns true if the env name existed, false otherwise.
+bool get_env(std::string_view name, std::string& value);