diff --git a/interfaces/kits/js/src/mod_fs/properties/ani/open_ani.cpp b/interfaces/kits/js/src/mod_fs/properties/ani/open_ani.cpp index 3a4049c073bea66166c8056c47c04d6bed76ef08..f49a38fcaafb90ba2552611e432b6aa5fcb2508b 100644 --- a/interfaces/kits/js/src/mod_fs/properties/ani/open_ani.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/ani/open_ani.cpp @@ -33,6 +33,7 @@ ani_object OpenAni::OpenSync(ani_env *env, [[maybe_unused]] ani_class clazz, ani #ifdef FILE_API_TRACE HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__); #endif + auto [succPath, filePath] = TypeConverter::ToUTF8String(env, path); if (!succPath) { HILOGE("Invalid path"); @@ -46,6 +47,7 @@ ani_object OpenAni::OpenSync(ani_env *env, [[maybe_unused]] ani_class clazz, ani ErrorHandler::Throw(env, EINVAL); return nullptr; } + FsResult ret = OpenCore::DoOpen(filePath, modeOp); if (!ret.IsSuccess()) { HILOGE("Open failed"); @@ -53,6 +55,7 @@ ani_object OpenAni::OpenSync(ani_env *env, [[maybe_unused]] ani_class clazz, ani ErrorHandler::Throw(env, err); return nullptr; } + const FsFile *file = ret.GetData().value(); auto result = FileWrapper::Wrap(env, move(file)); if (result == nullptr) {