From f6d348ee276e358eba14f95d2f4397706f8e43e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Thu, 20 Mar 2025 20:41:37 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.cpp | 49 +++++++++++++++++++ interfaces/kits/js/src/mod_fs/common_func.h | 6 +++ interfaces/kits/js/src/mod_fs/module.cpp | 2 + 3 files changed, 57 insertions(+) diff --git a/interfaces/kits/js/src/mod_fs/common_func.cpp b/interfaces/kits/js/src/mod_fs/common_func.cpp index 6193013a3..e830dfecd 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.cpp +++ b/interfaces/kits/js/src/mod_fs/common_func.cpp @@ -78,6 +78,55 @@ void InitAccessModeType(napi_env env, napi_value exports) } } +void InitAccessFlagType(napi_env env, napi_value exports) +{ + char propertyName[] = "AccessFlagType"; + napi_property_descriptor desc[] = { + DECLARE_NAPI_STATIC_PROPERTY("LOCAL", NVal::CreateInt32(env, MODE_LOCAL).val_), + }; + napi_value obj = nullptr; + napi_status status = napi_create_object(env, &obj); + if (status != napi_ok) { + HILOGE("Failed to create object at initializing openMode"); + return; + } + status = napi_define_properties(env, obj, sizeof(desc) / sizeof(desc[0]), desc); + if (status != napi_ok) { + HILOGE("Failed to set properties of character at initializing openMode"); + return; + } + status = napi_set_named_property(env, exports, propertyName, obj); + if (status != napi_ok) { + HILOGE("Failed to set direction property at initializing openMode"); + return; + } +} + +void InitLocationType(napi_env env, napi_value exports) +{ + char propertyName[] = "LocationType"; + napi_property_descriptor desc[] = { + DECLARE_NAPI_STATIC_PROPERTY("LOCAl", NVal::CreateInt32(env, MODE_C_LOCAl).val_), + DECLARE_NAPI_STATIC_PROPERTY("CLOUD", NVal::CreateInt32(env, MODE_CLOUD).val_), + }; + napi_value obj = nullptr; + napi_status status = napi_create_object(env, &obj); + if (status != napi_ok) { + HILOGE("Failed to create object at initializing openMode"); + return; + } + status = napi_define_properties(env, obj, sizeof(desc) / sizeof(desc[0]), desc); + if (status != napi_ok) { + HILOGE("Failed to set properties of character at initializing openMode"); + return; + } + status = napi_set_named_property(env, exports, propertyName, obj); + if (status != napi_ok) { + HILOGE("Failed to set direction property at initializing openMode"); + return; + } +} + void InitOpenMode(napi_env env, napi_value exports) { char propertyName[] = "OpenMode"; diff --git a/interfaces/kits/js/src/mod_fs/common_func.h b/interfaces/kits/js/src/mod_fs/common_func.h index 567cf26b4..832325a9e 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.h +++ b/interfaces/kits/js/src/mod_fs/common_func.h @@ -44,6 +44,10 @@ constexpr unsigned int MODE_WRITE = 02; constexpr unsigned int MODE_READ = 04; constexpr unsigned int MODE_READ_WRITE = 06; +constexpr unsigned int MODE_LOCAL = 00; +constexpr unsigned int MODE_C_LOCAl = 01; +constexpr unsigned int MODE_CLOUD = 02; + constexpr unsigned int USR_READ_ONLY = 00; constexpr unsigned int USR_WRITE_ONLY = 01; constexpr unsigned int USR_RDWR = 02; @@ -75,6 +79,8 @@ public: #endif void InitAccessModeType(napi_env env, napi_value exports); +void InitAccessFlagType(napi_env env, napi_value exports); +void InitLocationType(napi_env env, napi_value exports); void InitOpenMode(napi_env env, napi_value exports); void InitWhenceType(napi_env env, napi_value exports); diff --git a/interfaces/kits/js/src/mod_fs/module.cpp b/interfaces/kits/js/src/mod_fs/module.cpp index 8944c27a6..cdbc61f85 100644 --- a/interfaces/kits/js/src/mod_fs/module.cpp +++ b/interfaces/kits/js/src/mod_fs/module.cpp @@ -39,6 +39,8 @@ namespace ModuleFileIO { static napi_value Export(napi_env env, napi_value exports) { InitAccessModeType(env, exports); + InitAccessFlagType(env, exports); + InitLocationType(env, exports); InitOpenMode(env, exports); InitWhenceType(env, exports); std::vector> products; -- Gitee From 1fe6d3367d6c86e555f4d7aa6c56b6750277c751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Fri, 21 Mar 2025 00:48:31 +0000 Subject: [PATCH 2/6] update interfaces/kits/js/src/mod_fs/common_func.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/kits/js/src/mod_fs/common_func.h b/interfaces/kits/js/src/mod_fs/common_func.h index 832325a9e..b850f6555 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.h +++ b/interfaces/kits/js/src/mod_fs/common_func.h @@ -45,7 +45,7 @@ constexpr unsigned int MODE_READ = 04; constexpr unsigned int MODE_READ_WRITE = 06; constexpr unsigned int MODE_LOCAL = 00; -constexpr unsigned int MODE_C_LOCAl = 01; +constexpr unsigned int MODE_C_LOCAL = 01; constexpr unsigned int MODE_CLOUD = 02; constexpr unsigned int USR_READ_ONLY = 00; -- Gitee From 022ed2846b00c4c90330acf4f469b60e563eb3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Fri, 21 Mar 2025 01:38:24 +0000 Subject: [PATCH 3/6] update interfaces/kits/js/src/mod_fs/common_func.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/kits/js/src/mod_fs/common_func.cpp b/interfaces/kits/js/src/mod_fs/common_func.cpp index e830dfecd..b9043cbc0 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.cpp +++ b/interfaces/kits/js/src/mod_fs/common_func.cpp @@ -106,7 +106,7 @@ void InitLocationType(napi_env env, napi_value exports) { char propertyName[] = "LocationType"; napi_property_descriptor desc[] = { - DECLARE_NAPI_STATIC_PROPERTY("LOCAl", NVal::CreateInt32(env, MODE_C_LOCAl).val_), + DECLARE_NAPI_STATIC_PROPERTY("LOCAl", NVal::CreateInt32(env, MODE_C_LOCAL).val_), DECLARE_NAPI_STATIC_PROPERTY("CLOUD", NVal::CreateInt32(env, MODE_CLOUD).val_), }; napi_value obj = nullptr; -- Gitee From 09e323f4f0442b6d7e356f5776a6e3f0e72943ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Fri, 21 Mar 2025 06:59:02 +0000 Subject: [PATCH 4/6] update interfaces/kits/js/src/mod_fs/common_func.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/common_func.cpp b/interfaces/kits/js/src/mod_fs/common_func.cpp index b9043cbc0..61e911440 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.cpp +++ b/interfaces/kits/js/src/mod_fs/common_func.cpp @@ -106,8 +106,8 @@ void InitLocationType(napi_env env, napi_value exports) { char propertyName[] = "LocationType"; napi_property_descriptor desc[] = { - DECLARE_NAPI_STATIC_PROPERTY("LOCAl", NVal::CreateInt32(env, MODE_C_LOCAL).val_), - DECLARE_NAPI_STATIC_PROPERTY("CLOUD", NVal::CreateInt32(env, MODE_CLOUD).val_), + DECLARE_NAPI_STATIC_PROPERTY("LOCAl", NVal::CreateInt32(env, MODE_LOCATION_LOCAL).val_), + DECLARE_NAPI_STATIC_PROPERTY("CLOUD", NVal::CreateInt32(env, MODE_LOCATION_CLOUD).val_), }; napi_value obj = nullptr; napi_status status = napi_create_object(env, &obj); -- Gitee From c6041f19fbe984fabbf9c2960e3bcf5d87a3286d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Fri, 21 Mar 2025 07:01:16 +0000 Subject: [PATCH 5/6] update interfaces/kits/js/src/mod_fs/common_func.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/common_func.h b/interfaces/kits/js/src/mod_fs/common_func.h index b850f6555..7b6a2052b 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.h +++ b/interfaces/kits/js/src/mod_fs/common_func.h @@ -45,8 +45,8 @@ constexpr unsigned int MODE_READ = 04; constexpr unsigned int MODE_READ_WRITE = 06; constexpr unsigned int MODE_LOCAL = 00; -constexpr unsigned int MODE_C_LOCAL = 01; -constexpr unsigned int MODE_CLOUD = 02; +constexpr unsigned int MODE_LOCATION_LOCAL = 01; +constexpr unsigned int MODE_LOCATION_CLOUD = 02; constexpr unsigned int USR_READ_ONLY = 00; constexpr unsigned int USR_WRITE_ONLY = 01; -- Gitee From 18e206fc2b573c18de85ce081441e0cfd8f6c2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Fri, 21 Mar 2025 07:25:22 +0000 Subject: [PATCH 6/6] update interfaces/kits/js/src/mod_fs/common_func.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/common_func.cpp b/interfaces/kits/js/src/mod_fs/common_func.cpp index 61e911440..46e0cf653 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.cpp +++ b/interfaces/kits/js/src/mod_fs/common_func.cpp @@ -87,17 +87,17 @@ void InitAccessFlagType(napi_env env, napi_value exports) napi_value obj = nullptr; napi_status status = napi_create_object(env, &obj); if (status != napi_ok) { - HILOGE("Failed to create object at initializing openMode"); + HILOGE("Failed to create object at initializing AccessFlagType"); return; } status = napi_define_properties(env, obj, sizeof(desc) / sizeof(desc[0]), desc); if (status != napi_ok) { - HILOGE("Failed to set properties of character at initializing openMode"); + HILOGE("Failed to set properties of character at initializing AccessFlagType"); return; } status = napi_set_named_property(env, exports, propertyName, obj); if (status != napi_ok) { - HILOGE("Failed to set direction property at initializing openMode"); + HILOGE("Failed to set direction property at initializing AccessFlagType"); return; } } @@ -112,17 +112,17 @@ void InitLocationType(napi_env env, napi_value exports) napi_value obj = nullptr; napi_status status = napi_create_object(env, &obj); if (status != napi_ok) { - HILOGE("Failed to create object at initializing openMode"); + HILOGE("Failed to create object at initializing LocationType"); return; } status = napi_define_properties(env, obj, sizeof(desc) / sizeof(desc[0]), desc); if (status != napi_ok) { - HILOGE("Failed to set properties of character at initializing openMode"); + HILOGE("Failed to set properties of character at initializing LocationType"); return; } status = napi_set_named_property(env, exports, propertyName, obj); if (status != napi_ok) { - HILOGE("Failed to set direction property at initializing openMode"); + HILOGE("Failed to set direction property at initializing LocationType"); return; } } -- Gitee