From 555d5d954836e15e4dddce83d1e3173f6ed2b388 Mon Sep 17 00:00:00 2001 From: dengjun Date: Thu, 16 Nov 2023 15:47:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dengjun --- bundle.json | 3 ++- interfaces/kits/js/BUILD.gn | 2 ++ .../kits/js/src/mod_fs/properties/open.cpp | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/bundle.json b/bundle.json index dbf370104..4b7315b04 100644 --- a/bundle.json +++ b/bundle.json @@ -37,7 +37,8 @@ "napi", "samgr", "app_file_service", - "build_framework" + "build_framework", + "init" ], "third_party": [ "bounds_checking_function", diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index dabc9346d..61de8e5bd 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -98,6 +98,7 @@ ohos_shared_library("fileio") { external_deps = [ "hilog:libhilog", "napi:ace_napi", + "init:libbegetutil", ] defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] } @@ -155,6 +156,7 @@ ohos_shared_library("fs") { external_deps = [ "hilog:libhilog", "napi:ace_napi", + "init:libbegetutil", ] if (!use_mingw_win && !use_mac) { diff --git a/interfaces/kits/js/src/mod_fs/properties/open.cpp b/interfaces/kits/js/src/mod_fs/properties/open.cpp index d13c83b40..78343ed36 100644 --- a/interfaces/kits/js/src/mod_fs/properties/open.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/open.cpp @@ -36,6 +36,7 @@ #include "status_receiver_host.h" #include "system_ability_definition.h" #include "file_uri.h" +#include "parameter.h" #endif namespace OHOS { @@ -58,12 +59,29 @@ const std::string MEDIA = "media"; const std::string DOCS = "docs"; const std::string DATASHARE = "datashare"; const std::string SCHEME_BROKER = "content"; +const int32_t FULL_MOUT_ENABLE_SIZE = 6; +const char* g_filemanagerFullMoutEnableParameter = "const.filemanager.full_mount.enable"; #if !defined(WIN_PLATFORM) && !defined(IOS_PLATFORM) constexpr uint32_t MAX_WANT_FLAG = 4; #endif +namespace { + bool CheckFilemanagerFullMoutEnable() + { + char value[FULL_MOUT_ENABLE_SIZE] = "false"; + int retSysParam = GetParameter(g_filemanagerFullMoutEnableParameter, "false", value, FULL_MOUT_ENABLE_SIZE); + if (retSysParam > 0 && !std::strcmp(value, "true")) { + return true; + } + return false; + } +} + static tuple GetJsFlags(napi_env env, const NFuncArg &funcArg) { + if (!CheckFilemanagerFullMoutEnable()) { + return { false, 1 }; + } unsigned int flags = O_RDONLY; if (funcArg.GetArgc() >= NARG_CNT::TWO) { auto [succ, mode] = NVal(env, funcArg[NARG_POS::SECOND]).ToInt32(O_RDONLY); -- Gitee