From 2ab9d6ffbc4aad8ab3a393bd32191e3c07103c0a Mon Sep 17 00:00:00 2001 From: Lukas Oesch Date: Tue, 5 May 2026 14:37:47 +0200 Subject: fix problem with string_view lifetime --- kernel/include/kernel/filesystem/path.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'kernel/include') diff --git a/kernel/include/kernel/filesystem/path.hpp b/kernel/include/kernel/filesystem/path.hpp index 976926f..298ac5f 100644 --- a/kernel/include/kernel/filesystem/path.hpp +++ b/kernel/include/kernel/filesystem/path.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace kernel::filesystem::path { @@ -43,12 +44,12 @@ namespace kernel::filesystem::path /** @brief Splits the given path into its components. @param path The path to split. - @return A range of string views representing the components of the path. + @return A range of strings representing the components of the path. */ auto inline split(std::string_view path) { return std::views::split(path, '/') | std::views::filter([](auto const & part) { return !part.empty(); }) | - std::views::transform([](auto const & part) { return std::string_view(part.begin(), part.end()); }); + std::views::transform([](auto const & part) { return kstd::string(std::string_view(part.begin(), part.end())); }); } } // namespace kernel::filesystem::path -- cgit v1.2.3