From d6e89d6e6521aa0e1ebce207ff17997ea2e1a3d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=8F=BD=E5=92=8C=E7=8C=AA=E6=89=92?= Date: Mon, 24 Mar 2025 11:26:56 +0800 Subject: [PATCH 1/7] symlink_ani MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 兔叽和猪扒 --- interfaces/kits/js/BUILD.gn | 2 + .../js/src/mod_fs/ani/bind_function_class.cpp | 2 + .../js/src/mod_fs/ani/ets/@ohos.file.fs.ets | 28 ++++++++++ .../src/mod_fs/properties/ani/symlink_ani.cpp | 53 +++++++++++++++++++ .../src/mod_fs/properties/ani/symlink_ani.h | 35 ++++++++++++ .../js/src/mod_fs/properties/symlink_core.cpp | 50 +++++++++++++++++ .../js/src/mod_fs/properties/symlink_core.h | 33 ++++++++++++ 7 files changed, 203 insertions(+) create mode 100644 interfaces/kits/js/src/mod_fs/properties/ani/symlink_ani.cpp create mode 100644 interfaces/kits/js/src/mod_fs/properties/ani/symlink_ani.h create mode 100644 interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp create mode 100644 interfaces/kits/js/src/mod_fs/properties/symlink_core.h diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index 9334220be..c897488a0 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -693,6 +693,7 @@ ohos_shared_library("ani_fs_class") { "src/mod_fs/properties/ani/truncate_ani.cpp", "src/mod_fs/properties/ani/unlink_ani.cpp", "src/mod_fs/properties/ani/write_ani.cpp", + "src/mod_fs/properties/ani/symlink_ani.cpp", "src/mod_fs/properties/close_core.cpp", "src/mod_fs/properties/copy_file_core.cpp", "src/mod_fs/properties/listfile_core.cpp", @@ -706,6 +707,7 @@ ohos_shared_library("ani_fs_class") { "src/mod_fs/properties/truncate_core.cpp", "src/mod_fs/properties/unlink_core.cpp", "src/mod_fs/properties/write_core.cpp", + "src/mod_fs/properties/symlink_core.cpp", ] deps = [ ":ohos_file_fs_abc_etc", diff --git a/interfaces/kits/js/src/mod_fs/ani/bind_function_class.cpp b/interfaces/kits/js/src/mod_fs/ani/bind_function_class.cpp index 065495c9a..b2e53ca5b 100644 --- a/interfaces/kits/js/src/mod_fs/ani/bind_function_class.cpp +++ b/interfaces/kits/js/src/mod_fs/ani/bind_function_class.cpp @@ -34,6 +34,7 @@ #include "truncate_ani.h" #include "unlink_ani.h" #include "write_ani.h" +#include "symlink_ani.h" using namespace OHOS::FileManagement::ModuleFileIO::ANI; @@ -88,6 +89,7 @@ static ani_status BindStaticMethods(ani_env *env) ani_native_function { "truncateSync", nullptr, reinterpret_cast(TruncateAni::TruncateSync) }, ani_native_function { "unlinkSync", nullptr, reinterpret_cast(UnlinkAni::UnlinkSync) }, ani_native_function { "writeSync", nullptr, reinterpret_cast(WriteAni::WriteSync) }, + ani_native_function { "symlinkSync", nullptr, reinterpret_cast(SymlinkAni::SymlinkSync) }, }; return BindClass(env, className, methods); } diff --git a/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets b/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets index 67eb95add..82634ceed 100644 --- a/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets +++ b/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets @@ -492,6 +492,33 @@ function stat(file: string | number, callback: AsyncCallback): void }); } +function symlinkSync(target: string, srcPath: string): void { + return FileIoImpl.symlinkSync(target, srcPath); +} + +function symlink(target: string, srcPath: string): Promise { + return new Promise((resolve: (result: undefined) => void, + reject: (e: BusinessError) => void): void => { + let promise = taskpool.execute((target: string, srcPath: string): undefined => symlinkSync(target, srcPath), target, srcPath); + promise.then((ret: NullishType): void => { + resolve(undefined); + }).catch((e: BusinessError): void => { + reject(e); + }); + }); +} + +function symlink(target: string, srcPath: string, callback: AsyncCallback): void { + let promise = taskpool.execute((target: string, srcPath: string): undefined => symlinkSync(target, srcPath), target, srcPath); + promise.then((ret: NullishType): void => { + let e = new BusinessError(); + e.code = 0; + callback(e, undefined); + }).catch((e: BusinessError): void => { + callback(e, undefined); + }); +} + export interface Filter { suffix?: Array; displayName?: Array; @@ -659,4 +686,5 @@ class FileIoImpl { static native writeSync(fd: number, buffer: string | ArrayBuffer, options?: WriteOptions): number; + static native symlinkSync(target: string, srcPath: string): void; } diff --git a/interfaces/kits/js/src/mod_fs/properties/ani/symlink_ani.cpp b/interfaces/kits/js/src/mod_fs/properties/ani/symlink_ani.cpp new file mode 100644 index 000000000..4cbac5133 --- /dev/null +++ b/interfaces/kits/js/src/mod_fs/properties/ani/symlink_ani.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "symlink_ani.h" + +#include "error_handler.h" +#include "filemgmt_libhilog.h" +#include "symlink_core.h" +#include "type_converter.h" + +namespace OHOS { +namespace FileManagement { +namespace ModuleFileIO { +namespace ANI { + +void SymlinkAni::SymlinkSync(ani_env *env, [[maybe_unused]] ani_class clazz, ani_string target, ani_string srcPath) +{ + auto [succTarget, targetPath] = TypeConverter::ToUTF8String(env, target); + if (!succTarget) { + HILOGE("Invalid target"); + ErrorHandler::Throw(env, EINVAL); + return; + } + auto [succSrc, src] = TypeConverter::ToUTF8String(env, srcPath); + if (!succSrc) { + HILOGE("Invalid src"); + ErrorHandler::Throw(env, EINVAL); + return; + } + auto ret = SymlinkCore::DoSymlink(targetPath, src); + if (!ret.IsSuccess()) { + HILOGE("DoSymlink failed"); + const auto &err = ret.GetError(); + ErrorHandler::Throw(env, err); + return; + } +} +} // namespace ANI +} // namespace ModuleFileIO +} // namespace FileManagement +} // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/js/src/mod_fs/properties/ani/symlink_ani.h b/interfaces/kits/js/src/mod_fs/properties/ani/symlink_ani.h new file mode 100644 index 000000000..6ba3abb55 --- /dev/null +++ b/interfaces/kits/js/src/mod_fs/properties/ani/symlink_ani.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INTERFACES_KITS_JS_SRC_MOD_FS_SYMLINK_ANI_H +#define INTERFACES_KITS_JS_SRC_MOD_FS_SYMLINK_ANI_H + +#include + +namespace OHOS { +namespace FileManagement { +namespace ModuleFileIO { +namespace ANI { + +class SymlinkAni final { +public: + static void SymlinkSync(ani_env *env, [[maybe_unused]] ani_class clazz, ani_string target, ani_string srcPath); +}; +} // namespace ANI +} // namespace ModuleFileIO +} // namespace FileManagement +} // namespace OHOS + +#endif // INTERFACES_KITS_JS_SRC_MOD_FS_SYMLINK_ANI_H \ No newline at end of file diff --git a/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp b/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp new file mode 100644 index 000000000..8c8742359 --- /dev/null +++ b/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "symlink_core.h" + +#include +#include +#include +#include + +#include "filemgmt_libhilog.h" + +namespace OHOS { +namespace FileManagement { +namespace ModuleFileIO { +using namespace std; + +FsResult SymlinkCore::DoSymlink(const string &target, const string &srcPath) { + if (target.empty() || srcPath.empty()) { + HILOGE("Invalid path"); + return FsResult::Error(EINVAL); + } + std::unique_ptr symlink_req = { + new uv_fs_t, FsUtils::FsReqCleanup }; + if (!symlink_req) { + HILOGE("Failed to request heap memory."); + return FsResult::Error(ENOMEM); + } + int ret = uv_fs_symlink(nullptr, symlink_req.get(), target.c_str(), srcPath.c_str(), 0, nullptr); + if (ret < 0) { + HILOGE("Failed to create a link for old path"); + return FsResult::Error(ret); + } + return FsResult::Success(); +} +} // namespace ModuleFileIO +} // namespace FileManagement +} // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/js/src/mod_fs/properties/symlink_core.h b/interfaces/kits/js/src/mod_fs/properties/symlink_core.h new file mode 100644 index 000000000..67333fe6c --- /dev/null +++ b/interfaces/kits/js/src/mod_fs/properties/symlink_core.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_SYMLINK_CORE_H +#define INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_SYMLINK_CORE_H + +#include "filemgmt_libfs.h" +#include "fs_utils.h" + +namespace OHOS { +namespace FileManagement { +namespace ModuleFileIO { +class SymlinkCore final { +public: + static FsResult DoSymlink(const string &target, const string &srcPath); +}; +const std::string PROCEDURE_RMDIRENT_NAME = "FileIOSymLink"; +} // namespace ModuleFileIO +} // namespace FileManagement +} // namespace OHOS +#endif // INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_SYMLINK_CORE_H \ No newline at end of file -- Gitee From 24382b25a7b02cfd7428997ae9e426eb62539e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=8F=BD=E5=92=8C=E7=8C=AA=E6=89=92?= Date: Mon, 24 Mar 2025 14:50:18 +0800 Subject: [PATCH 2/7] =?UTF-8?q?symlink=20ets=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 兔叽和猪扒 --- interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets b/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets index 82634ceed..e0425904e 100644 --- a/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets +++ b/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets @@ -499,7 +499,7 @@ function symlinkSync(target: string, srcPath: string): void { function symlink(target: string, srcPath: string): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { - let promise = taskpool.execute((target: string, srcPath: string): undefined => symlinkSync(target, srcPath), target, srcPath); + let promise = taskpool.execute((target: string, srcPath: string): undefined => FileIoImpl.symlinkSync(target, srcPath), target, srcPath); promise.then((ret: NullishType): void => { resolve(undefined); }).catch((e: BusinessError): void => { @@ -509,7 +509,7 @@ function symlink(target: string, srcPath: string): Promise { } function symlink(target: string, srcPath: string, callback: AsyncCallback): void { - let promise = taskpool.execute((target: string, srcPath: string): undefined => symlinkSync(target, srcPath), target, srcPath); + let promise = taskpool.execute((target: string, srcPath: string): undefined => FileIoImpl.symlinkSync(target, srcPath), target, srcPath); promise.then((ret: NullishType): void => { let e = new BusinessError(); e.code = 0; -- Gitee From e82403e80f31242f95533fcb82ee3d5674dcf032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=8F=BD=E5=92=8C=E7=8C=AA=E6=89=92?= Date: Mon, 24 Mar 2025 18:05:59 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=B0=8F=E9=A9=BC?= =?UTF-8?q?=E5=B3=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 兔叽和猪扒 --- .../kits/js/src/mod_fs/properties/symlink_core.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp b/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp index 8c8742359..cb26f6068 100644 --- a/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp @@ -28,17 +28,13 @@ namespace ModuleFileIO { using namespace std; FsResult SymlinkCore::DoSymlink(const string &target, const string &srcPath) { - if (target.empty() || srcPath.empty()) { - HILOGE("Invalid path"); - return FsResult::Error(EINVAL); - } - std::unique_ptr symlink_req = { + std::unique_ptr symlinkReq = { new uv_fs_t, FsUtils::FsReqCleanup }; - if (!symlink_req) { + if (!symlinkReq) { HILOGE("Failed to request heap memory."); return FsResult::Error(ENOMEM); } - int ret = uv_fs_symlink(nullptr, symlink_req.get(), target.c_str(), srcPath.c_str(), 0, nullptr); + int ret = uv_fs_symlink(nullptr, symlinkReq.get(), target.c_str(), srcPath.c_str(), 0, nullptr); if (ret < 0) { HILOGE("Failed to create a link for old path"); return FsResult::Error(ret); -- Gitee From 901684cdb94420d5138be807dfc08ffda337194a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=8F=BD=E5=92=8C=E7=8C=AA=E6=89=92?= Date: Mon, 24 Mar 2025 18:16:23 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 兔叽和猪扒 --- interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp | 1 + interfaces/kits/js/src/mod_fs/properties/symlink_core.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp b/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp index cb26f6068..3417fb5bf 100644 --- a/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp @@ -21,6 +21,7 @@ #include #include "filemgmt_libhilog.h" +#include "fs_utils.h" namespace OHOS { namespace FileManagement { diff --git a/interfaces/kits/js/src/mod_fs/properties/symlink_core.h b/interfaces/kits/js/src/mod_fs/properties/symlink_core.h index 67333fe6c..223c8b683 100644 --- a/interfaces/kits/js/src/mod_fs/properties/symlink_core.h +++ b/interfaces/kits/js/src/mod_fs/properties/symlink_core.h @@ -17,7 +17,6 @@ #define INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_SYMLINK_CORE_H #include "filemgmt_libfs.h" -#include "fs_utils.h" namespace OHOS { namespace FileManagement { -- Gitee From 13309e389ac5026534ce97a592068b1755d9d0d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=8F=BD=E5=92=8C=E7=8C=AA=E6=89=92?= Date: Tue, 25 Mar 2025 17:16:40 +0800 Subject: [PATCH 5/7] =?UTF-8?q?symlink=20=E6=A0=BC=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 兔叽和猪扒 --- .../kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets | 8 ++++++-- .../kits/js/src/mod_fs/properties/symlink_core.cpp | 10 +++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets b/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets index e0425904e..7f51fe584 100644 --- a/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets +++ b/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets @@ -499,7 +499,9 @@ function symlinkSync(target: string, srcPath: string): void { function symlink(target: string, srcPath: string): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { - let promise = taskpool.execute((target: string, srcPath: string): undefined => FileIoImpl.symlinkSync(target, srcPath), target, srcPath); + let promise = taskpool.execute((target: string, srcPath: string): undefined => { + return FileIoImpl.symlinkSync(target, srcPath); + }, target, srcPath); promise.then((ret: NullishType): void => { resolve(undefined); }).catch((e: BusinessError): void => { @@ -509,7 +511,9 @@ function symlink(target: string, srcPath: string): Promise { } function symlink(target: string, srcPath: string, callback: AsyncCallback): void { - let promise = taskpool.execute((target: string, srcPath: string): undefined => FileIoImpl.symlinkSync(target, srcPath), target, srcPath); + let promise = taskpool.execute((target: string, srcPath: string): undefined => { + return FileIoImpl.symlinkSync(target, srcPath); + }, target, srcPath); promise.then((ret: NullishType): void => { let e = new BusinessError(); e.code = 0; diff --git a/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp b/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp index 3417fb5bf..c44718718 100644 --- a/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/symlink_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -28,14 +28,14 @@ namespace FileManagement { namespace ModuleFileIO { using namespace std; -FsResult SymlinkCore::DoSymlink(const string &target, const string &srcPath) { - std::unique_ptr symlinkReq = { - new uv_fs_t, FsUtils::FsReqCleanup }; +FsResult SymlinkCore::DoSymlink(const string &target, const string &srcPath) +{ + std::unique_ptr symlinkReq = { new uv_fs_t, FsUtils::FsReqCleanup }; if (!symlinkReq) { HILOGE("Failed to request heap memory."); return FsResult::Error(ENOMEM); } - int ret = uv_fs_symlink(nullptr, symlinkReq.get(), target.c_str(), srcPath.c_str(), 0, nullptr); + int ret = uv_fs_symlink(nullptr, symlinkReq.get(), srcPath.c_str(), target.c_str(), 0, nullptr); if (ret < 0) { HILOGE("Failed to create a link for old path"); return FsResult::Error(ret); -- Gitee From ba1c6cc983efe04aeb91c02e097071e5cd98cf6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=8F=BD=E5=92=8C=E7=8C=AA=E6=89=92?= Date: Tue, 25 Mar 2025 20:01:41 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E4=B8=BA=E5=AD=97=E5=85=B8=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 兔叽和猪扒 --- interfaces/kits/js/src/mod_fs/ani/bind_function_class.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/ani/bind_function_class.cpp b/interfaces/kits/js/src/mod_fs/ani/bind_function_class.cpp index b2e53ca5b..1a4fb8c3e 100644 --- a/interfaces/kits/js/src/mod_fs/ani/bind_function_class.cpp +++ b/interfaces/kits/js/src/mod_fs/ani/bind_function_class.cpp @@ -31,10 +31,10 @@ #include "read_text_ani.h" #include "rmdir_ani.h" #include "stat_ani.h" +#include "symlink_ani.h" #include "truncate_ani.h" #include "unlink_ani.h" #include "write_ani.h" -#include "symlink_ani.h" using namespace OHOS::FileManagement::ModuleFileIO::ANI; @@ -86,10 +86,10 @@ static ani_status BindStaticMethods(ani_env *env) ani_native_function { "readTextSync", nullptr, reinterpret_cast(ReadTextAni::ReadTextSync) }, ani_native_function { "rmdirSync", nullptr, reinterpret_cast(RmdirAni::RmdirSync) }, ani_native_function { "statSync", nullptr, reinterpret_cast(StatAni::StatSync) }, + ani_native_function { "symlinkSync", nullptr, reinterpret_cast(SymlinkAni::SymlinkSync) }, ani_native_function { "truncateSync", nullptr, reinterpret_cast(TruncateAni::TruncateSync) }, ani_native_function { "unlinkSync", nullptr, reinterpret_cast(UnlinkAni::UnlinkSync) }, ani_native_function { "writeSync", nullptr, reinterpret_cast(WriteAni::WriteSync) }, - ani_native_function { "symlinkSync", nullptr, reinterpret_cast(SymlinkAni::SymlinkSync) }, }; return BindClass(env, className, methods); } -- Gitee From a867b3562bda07d40a49410dfc892dd40ce2c93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=8F=BD=E5=92=8C=E7=8C=AA=E6=89=92?= Date: Wed, 26 Mar 2025 09:37:26 +0800 Subject: [PATCH 7/7] =?UTF-8?q?build.gn=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 兔叽和猪扒 --- interfaces/kits/js/BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index c897488a0..768aca222 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -690,10 +690,10 @@ ohos_shared_library("ani_fs_class") { "src/mod_fs/properties/ani/read_ani.cpp", "src/mod_fs/properties/ani/read_text_ani.cpp", "src/mod_fs/properties/ani/rmdir_ani.cpp", + "src/mod_fs/properties/ani/symlink_ani.cpp", "src/mod_fs/properties/ani/truncate_ani.cpp", "src/mod_fs/properties/ani/unlink_ani.cpp", "src/mod_fs/properties/ani/write_ani.cpp", - "src/mod_fs/properties/ani/symlink_ani.cpp", "src/mod_fs/properties/close_core.cpp", "src/mod_fs/properties/copy_file_core.cpp", "src/mod_fs/properties/listfile_core.cpp", @@ -704,10 +704,10 @@ ohos_shared_library("ani_fs_class") { "src/mod_fs/properties/read_text_core.cpp", "src/mod_fs/properties/rmdir_core.cpp", "src/mod_fs/properties/stat_core.cpp", + "src/mod_fs/properties/symlink_core.cpp", "src/mod_fs/properties/truncate_core.cpp", "src/mod_fs/properties/unlink_core.cpp", "src/mod_fs/properties/write_core.cpp", - "src/mod_fs/properties/symlink_core.cpp", ] deps = [ ":ohos_file_fs_abc_etc", -- Gitee