From 9fbe9540db82aa4a09bd14f8a0d8dbc93f60a44b Mon Sep 17 00:00:00 2001 From: IsiGebauer Date: Mon, 23 Dec 2024 18:59:19 +0100 Subject: [PATCH] small fix to allow the foldername to be empty. JoinPath function then adds all the strings in args to one file-path --- base/file_name_utils.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/base/file_name_utils.hpp b/base/file_name_utils.hpp index 71107f7407..b2a9357e99 100644 --- a/base/file_name_utils.hpp +++ b/base/file_name_utils.hpp @@ -40,7 +40,12 @@ template std::string JoinPath(std::string const & folder, Args &&... args) { if (folder.empty()) - return {}; + { + if (sizeof...(args) == 0) + return {}; + else + return impl::JoinPath(std::forward(args)...); + } return AddSlashIfNeeded(folder) + impl::JoinPath(std::forward(args)...); } @@ -50,7 +55,6 @@ std::string JoinPath(std::string const & folder, Args &&... args) template std::string JoinPath(std::string const & dir, std::string const & fileOrDir, Args &&... args) { - ASSERT(!dir.empty(), ("JoinPath dir is empty")); ASSERT(!fileOrDir.empty(), ("JoinPath fileOrDir is empty")); return impl::JoinPath(dir, fileOrDir, std::forward(args)...); }