diff --git a/utils/filemgmt_libn/include/n_async/n_async_work_callback.h b/utils/filemgmt_libn/include/n_async/n_async_work_callback.h index 6fb5146687ac9553de41bf525595d28770345415..cb175e48c77e0785476ef81dc206cbd449177d18 100644 --- a/utils/filemgmt_libn/include/n_async/n_async_work_callback.h +++ b/utils/filemgmt_libn/include/n_async/n_async_work_callback.h @@ -21,6 +21,9 @@ namespace OHOS { namespace FileManagement { namespace LibN { + +const std::string CB_SECOND_ARG = "cb_second_arg"; + class NAsyncWorkCallback : public NAsyncWork { public: NAsyncWorkCallback(napi_env env, NVal thisPtr, NVal cb); diff --git a/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp b/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp index 3df058b8546c7bbaf23451aaad86018686188ecc..2153107aa530c0b0afd9113843b2f04b66c01a6b 100644 --- a/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp +++ b/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp @@ -168,6 +168,13 @@ static void AfterWorkCallback(napi_env env, napi_status status, void *data, NCon argv = {NError(ERRNO_NOERR).GetNapiErr(env), ctx->res_.val_}; } else { argv = {ctx->res_.val_}; + if (ctx->res_.HasProp(CB_SECOND_ARG)) { +#ifdef WIN_PLATFORM + argv.push_back(ctx->res_.GetPropValue(CB_SECOND_ARG).val_); +#else + argv.push_back(ctx->res_.GetProp(CB_SECOND_ARG).val_); +#endif + } } napi_value global = nullptr;