From 6648d56a2b6c9f1ffcbe89a9fb993f7031b440e9 Mon Sep 17 00:00:00 2001 From: 18795846185 Date: Wed, 9 Apr 2025 13:48:48 +0800 Subject: [PATCH] resource dir Signed-off-by: 18795846185 --- .../ability_runtime/application_context.h | 18 ++++++++++++++++++ .../libability_runtime.ndk.json | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/AbilityKit/ability_runtime/application_context.h b/AbilityKit/ability_runtime/application_context.h index bb39d5978..ed62cf402 100644 --- a/AbilityKit/ability_runtime/application_context.h +++ b/AbilityKit/ability_runtime/application_context.h @@ -213,6 +213,24 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDistributedFiles AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCloudFileDir( char* buffer, const int32_t bufferSize, int32_t* writeLength); +/** + * @brief Obtain the resource directory of the target module. + * + * @param moduleName The module name. + * @param buffer A pointer to a buffer that receives the resource directory of the target module. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 20 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetResourceDir(const char* moduleName, + char* buffer, const int32_t bufferSize, int32_t* writeLength); + /** * @brief Starts self UIAbility. * diff --git a/AbilityKit/ability_runtime/libability_runtime.ndk.json b/AbilityKit/ability_runtime/libability_runtime.ndk.json index 3ae8eaeee..6790d7d68 100644 --- a/AbilityKit/ability_runtime/libability_runtime.ndk.json +++ b/AbilityKit/ability_runtime/libability_runtime.ndk.json @@ -174,5 +174,9 @@ { "first_introduced": "17", "name": "OH_AbilityRuntime_GetStartOptionsMaxWindowHeight" + }, + { + "first_introduced": "20", + "name": "OH_AbilityRuntime_ApplicationContextGetResourceDir" } ] \ No newline at end of file -- Gitee