From 0d610f53a058660b9e334bc77174e47d811a31c7 Mon Sep 17 00:00:00 2001 From: zhangkaixiang Date: Sun, 23 Apr 2023 15:24:39 +0800 Subject: [PATCH] remove uri name deal Signed-off-by: zhangkaixiang --- .../kits/js/src/mod_fs/properties/open.cpp | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/properties/open.cpp b/interfaces/kits/js/src/mod_fs/properties/open.cpp index 0b2c44be2..822e9eaf6 100644 --- a/interfaces/kits/js/src/mod_fs/properties/open.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/open.cpp @@ -58,25 +58,6 @@ static tuple GetJsFlags(napi_env env, const NFuncArg &funcAr return { true, mode }; } -static string DealWithUriWithName(string str) -{ - static uint32_t MEET_COUNT = 6; - uint32_t count = 0; - uint32_t index; - for (index = 0; index < str.length(); index++) { - if (str[index] == '/') { - count++; - } - if (count == MEET_COUNT) { - break; - } - } - if (count == MEET_COUNT) { - str = str.substr(0, index); - } - return str; -} - static NVal InstantiateFile(napi_env env, int fd, string pathOrUri, bool isUri) { napi_value objFile = NClass::InstantiateClass(env, FileNExporter::className_, {}); @@ -127,7 +108,6 @@ static int OpenFileByDatashare(string path, unsigned int flags) HILOGE("Failed to connect to datashare"); return -E_PERMISSION; } - path = DealWithUriWithName(path); Uri uri(path); fd = dataShareHelper->OpenFile(uri, CommonFunc::GetModeFromFlags(flags)); return fd; -- Gitee