From 9541afc5338ed2d498eaec4804ca7f5a2470e610 Mon Sep 17 00:00:00 2001 From: nieben Date: Mon, 17 Mar 2025 10:40:39 +0800 Subject: [PATCH] copyFileSync mode number Signed-off-by: nieben Change-Id: I5247a61013cd39c16b37081c6c65c148de391ae2 --- interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets | 8 ++++---- interfaces/kits/js/src/mod_fs/class_stat/ani/stat_ani.cpp | 2 ++ 2 files changed, 6 insertions(+), 4 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 2eb1c8b7..8d8157b3 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 @@ -324,7 +324,7 @@ class fileIo { }); } - static native copyFileSync(src: PathOrFd, dest: PathOrFd, mode?: int): void; + static native copyFileSync(src: string | number, dest: string | number, mode?: number): void; static native listFileSync(path: string, options?: ListFileOptions): string[]; @@ -661,9 +661,9 @@ class fileIo { static native rmdirSync(path: string): void; - static native statSync(file: PathOrFd): Stat; + static native statSync(file: string | number): Stat; - static stat(file: PathOrFd): Promise { + static stat(file: string | number): Promise { return new Promise((resolve: (result: Stat) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute(fileIo.statSync, file); promise.then((ret: NullishType) => { @@ -679,7 +679,7 @@ class fileIo { }); } - static stat(file: PathOrFd, callback: AsyncCallback): void { + static stat(file: string | number, callback: AsyncCallback): void { let p = taskpool.execute(fileIo.statSync, file); p.then((ret: NullishType) => { let err = new BusinessError(-1, ""); diff --git a/interfaces/kits/js/src/mod_fs/class_stat/ani/stat_ani.cpp b/interfaces/kits/js/src/mod_fs/class_stat/ani/stat_ani.cpp index 3c9161cb..23ec937f 100644 --- a/interfaces/kits/js/src/mod_fs/class_stat/ani/stat_ani.cpp +++ b/interfaces/kits/js/src/mod_fs/class_stat/ani/stat_ani.cpp @@ -133,11 +133,13 @@ static ani_status SetProperties(ani_env *env, const ani_class &cls, ani_object & } } +#if !defined(WIN_PLATFORM) && !defined(IOS_PLATFORM) if ((ret = SetEnumLocation(env, cls, statObject, "location", static_cast(fsStat->GetLocation()))) != ANI_OK) { HILOGE("Object_CallMethod_Void Fail location, err: %{private}d", ret); return ret; } +#endif return ANI_OK; } -- Gitee