From 0d4aec88d16933410963b9f2756cdf46c9aaa5a2 Mon Sep 17 00:00:00 2001 From: halx99 Date: Thu, 15 Jul 2021 23:10:36 +0800 Subject: [PATCH] Improve code style --- cocos/ui/UIWebView/UIWebViewImpl-android.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cocos/ui/UIWebView/UIWebViewImpl-android.cpp b/cocos/ui/UIWebView/UIWebViewImpl-android.cpp index 92794f50ec..f8a05b2523 100644 --- a/cocos/ui/UIWebView/UIWebViewImpl-android.cpp +++ b/cocos/ui/UIWebView/UIWebViewImpl-android.cpp @@ -145,15 +145,14 @@ std::string getUrlStringByFileName(const std::string& fileName) { // LOGD("error: %s,%d",__func__,__LINE__); const std::string basePath("file:///android_asset/"); - using namespace cxx17; - const auto assetsPath = "assets/"_sv; + using namespace cxx17; // for cxx17::string_view literal std::string fullPath = cocos2d::FileUtils::getInstance()->fullPathForFilename(fileName); std::string urlString; if (fullPath.empty()) { return urlString; } else if (fullPath[0] == '/') { urlString.append("file://").append(fullPath); - } else if (cxx20::starts_with(cxx17::string_view{fullPath}, assetsPath)) { + } else if (cxx20::starts_with(cxx17::string_view{fullPath}, "assets/"_sv)) { urlString = fullPath; } else { urlString.append(basePath).append(fullPath);