From 5ebea77ec4c6307295e518388584dec5a502d168 Mon Sep 17 00:00:00 2001 From: fundavid Date: Mon, 25 Nov 2024 15:08:16 +0800 Subject: [PATCH] use overloaded compare to reduce constructor Signed-off-by: fundavid --- utils/src/file_helper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/src/file_helper.cpp b/utils/src/file_helper.cpp index 75fc1eb..43ed4c2 100644 --- a/utils/src/file_helper.cpp +++ b/utils/src/file_helper.cpp @@ -33,7 +33,7 @@ bool CheckFilePathValid(const std::string &path, const std::string &baseRealPath return false; } return (realPath.size() > baseRealPath.size()) && - (baseRealPath.compare(realPath.substr(0, baseRealPath.size())) == 0); + (realPath.compare(0, baseRealPath.size(), baseRealPath) == 0); } } } -- Gitee