From 6e695e37be4ee5b17a85af034d51809a98819d5e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 19 Mar 2018 20:49:05 +1100 Subject: [PATCH] Fix real_path again --- src/file.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/file.cc b/src/file.cc index de57fb6f3..54efe12fd 100644 --- a/src/file.cc +++ b/src/file.cc @@ -79,7 +79,11 @@ String real_path(StringView filename) { if (non_existing.empty()) return res; - return format("{}/{}", res, non_existing); + + StringView dir = res; + if (dir.substr(dir.length()-1_byte, 1_byte) == "/") + dir = dir.substr(0_byte, dir.length()-1_byte); + return format("{}/{}", dir, non_existing); } auto it = find(existing.rbegin() + 1, existing.rend(), '/');