diff --git a/libluna/include/luna/PathParser.h b/libluna/include/luna/PathParser.h index 672b82e8..a8f8ecbc 100644 --- a/libluna/include/luna/PathParser.h +++ b/libluna/include/luna/PathParser.h @@ -17,6 +17,7 @@ class PathParser PathParser(const PathParser&) = delete; static Result join(StringView path1, StringView path2); + static Result join_paths(StringView path1, StringView path2); static Result realpath(StringView path); diff --git a/libluna/src/PathParser.cpp b/libluna/src/PathParser.cpp index 5116b47c..bb7271e9 100644 --- a/libluna/src/PathParser.cpp +++ b/libluna/src/PathParser.cpp @@ -62,6 +62,13 @@ Result PathParser::dirname(StringView path) } Result PathParser::join(StringView path1, StringView path2) +{ + String result = TRY(join_paths(path1, path2)); + + return realpath(result.view()); +} + +Result PathParser::join_paths(StringView path1, StringView path2) { StringBuilder sb; TRY(sb.add(path1)); @@ -70,9 +77,7 @@ Result PathParser::join(StringView path1, StringView path2) TRY(sb.add(path2)); - String result = TRY(sb.string()); - - return realpath(result.view()); + return sb.string(); } Result PathParser::realpath(StringView path)