diff --git a/bundle.json b/bundle.json index e8b3be68694eb2492eeaae594120799a49d493d7..3355df8c655a1ee53a9567035f91d2b6f02aff6c 100644 --- a/bundle.json +++ b/bundle.json @@ -72,7 +72,9 @@ "//foundation/filemanagement/app_file_service/interfaces/kits/ani/file_uri:fileuri_ani_package", "//foundation/filemanagement/app_file_service/interfaces/kits/ndk/fileuri/src:ohfileuri", "//foundation/filemanagement/app_file_service/interfaces/kits/ndk/fileshare/src:ohfileshare", - "//foundation/filemanagement/app_file_service/frameworks/native/backup_ext/ani:backup_ext_ani_package" + "//foundation/filemanagement/app_file_service/frameworks/native/backup_ext/ani:backup_ext_ani_package", + "//foundation/filemanagement/app_file_service/interfaces/kits/taihe/fileuri:afs_fileuri_taihe", + "//foundation/filemanagement/app_file_service/interfaces/kits/taihe/fileshare:afs_fileshare_taihe" ], "service_group": [ "//foundation/filemanagement/app_file_service:tgt_backup_extension", diff --git a/interfaces/kits/taihe/fileshare/BUILD.gn b/interfaces/kits/taihe/fileshare/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..1fce46dad001425d16ba649b84f0fb163ee252e6 --- /dev/null +++ b/interfaces/kits/taihe/fileshare/BUILD.gn @@ -0,0 +1,98 @@ +# 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. + +import("//build/config/components/ets_frontend/ets2abc_config.gni") +import("//build/ohos.gni") +import("//build/ohos/taihe_idl/taihe.gni") +import("//foundation/filemanagement/app_file_service/app_file_service.gni") + +part_name = "app_file_service" +subsystem_name = "filemanagement" +taihe_generated_file_path = "$taihe_file_path/out/$subsystem_name/$part_name/fileshare" + +copy_taihe_idl("copy_taihe") { + sources = [ "${app_file_service_path}/interfaces/kits/taihe/fileshare/idl/ohos.fileshare.taihe" ] +} + +ohos_taihe("run_taihe") { + taihe_generated_file_path = "$taihe_generated_file_path" + deps = [ ":copy_taihe" ] + outputs = [ + "$taihe_generated_file_path/src/ohos.fileshare.ani.cpp", + "$taihe_generated_file_path/src/ohos.fileshare.abi.c", + ] +} + +taihe_shared_library("file_share_taihe") { + taihe_generated_file_path = "$taihe_generated_file_path" + subsystem_name = "filemanagement" + part_name = "app_file_service" + + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + + include_dirs = [ + "include", + "${app_file_service_path}/interfaces/common/include/log.h", + "${app_file_service_path}/interfaces/innerkits/native/file_share/include", + "${app_file_service_path}/interfaces/kits/ndk/fileshare/include" + ] + + sources = get_target_outputs(":run_taihe") + sources += [ + "src/ani_constructor.cpp", + "src/grant_permissons.cpp" + ] + + deps = [ + ":run_taihe", + "${app_file_service_path}/interfaces/innerkits/native:fileshare_native", + ] + + external_deps = [ + "hilog:libhilog", + "hitrace:hitrace_meter", + ] +} + +generate_static_abc("file_share_taihe_abc") { + base_url = "$taihe_generated_file_path" + files = [ "$taihe_generated_file_path/@ohos.fileshare.ets" ] + is_boot_abc = "True" + device_dst_file = "/system/framework/file_share_taihe_abc.abc" + dependencies = [ ":run_taihe" ] + +} + +ohos_prebuilt_etc("file_share_etc") { + source = "$target_out_dir/file_share_taihe_abc.abc" + module_install_dir = "framework" + part_name = "app_file_service" + subsystem_name = "filemanagement" + deps = [ + ":file_share_taihe_abc", + ] +} + +group("afs_fileshare_taihe") { + deps = [ + ":file_share_taihe", + ":file_share_etc", + ] +} diff --git a/interfaces/kits/taihe/fileshare/idl/ohos.fileshare.taihe b/interfaces/kits/taihe/fileshare/idl/ohos.fileshare.taihe new file mode 100644 index 0000000000000000000000000000000000000000..79ad429bafae3c4516701b295f62bacc10cc3393 --- /dev/null +++ b/interfaces/kits/taihe/fileshare/idl/ohos.fileshare.taihe @@ -0,0 +1,41 @@ +/* +* 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. +*/ + +@!namespace("@ohos.fileshare","fileShare") + +@!sts_inject(""" +static { loadLibrary("file_share_taihe.z"); } +""") + +enum OperationMode: i32 { + READ_MODE = 1, + WRITE_MODE = 2, +} + +struct PolicyInfo { + uri: String; + operationMode: i32; +} +function makePolicyInfo(uri: String, operationMode: i32): PolicyInfo; + +@gen_promise("activatePermission") +function activatePermissionSync( + policies: Array +): void; + +@gen_promise("deactivatePermission") +function deactivatePermissionSync( + policies: Array +): void; diff --git a/interfaces/kits/taihe/fileshare/include/grant_permissons.h b/interfaces/kits/taihe/fileshare/include/grant_permissons.h new file mode 100644 index 0000000000000000000000000000000000000000..4472ee5a1bac7d6f23f2307c76f467d61709db51 --- /dev/null +++ b/interfaces/kits/taihe/fileshare/include/grant_permissons.h @@ -0,0 +1,38 @@ +/* +* 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 FILEMANAGEMENT_APP_FILE_SERVICE_INTERFACES_FILE_SHARE_TAIHE_GRANT_PERMISSONS_H +#define FILEMANAGEMENT_APP_FILE_SERVICE_INTERFACES_FILE_SHARE_TAIHE_GRANT_PERMISSONS_H + +#include "ohos.fileshare.proj.hpp" +#include "ohos.fileshare.impl.hpp" +#include "taihe/runtime.hpp" +#include "file_permission.h" + +namespace ANI::FileShare { + + ohos::fileshare::PolicyInfo makePolicyInfo(taihe::string_view uri, int32_t operationMode); + void activatePermissionSync(taihe::array_view policies); + void deactivatePermissionSync(taihe::array_view policies); + + struct PolicyErrorArgs { + std::deque errorResults; + int32_t errNo = 0; + ~PolicyErrorArgs() = default; + }; + +} //namespace ANI::FileShare + +#endif // FILEMANAGEMENT_APP_FILE_SERVICE_INTERFACES_FILE_SHARE_TAIHE_GRANT_PERMISSONS_H diff --git a/interfaces/kits/taihe/fileshare/src/ani_constructor.cpp b/interfaces/kits/taihe/fileshare/src/ani_constructor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..605757338cc9479a66b90fea9d7f69865786d888 --- /dev/null +++ b/interfaces/kits/taihe/fileshare/src/ani_constructor.cpp @@ -0,0 +1,34 @@ +/* +* 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 FILEMANAGEMENT_APP_FILE_SERVICE_INTERFACES_FILE_SHARE_TAIHE_ANI_CONSTRUCTOR_H +#define FILEMANAGEMENT_APP_FILE_SERVICE_INTERFACES_FILE_SHARE_TAIHE_ANI_CONSTRUCTOR_H + +#include "ohos.fileshare.ani.hpp" + +ANI_EXPORT ani_status ANI_Constructor(ani_vm *vm, uint32_t *result) +{ + ani_env *env; + if (ANI_OK != vm->GetEnv(ANI_VERSION_1, &env)) { + return ANI_ERROR; + } + if (ANI_OK != ohos::fileshare::ANIRegister(env)) { + std::cerr << "Error from ohos::fileshare::ANIRegister" << std::endl; + return ANI_ERROR; + } + *result = ANI_VERSION_1; + return ANI_OK; +} + +#endif // FILEMANAGEMENT_APP_FILE_SERVICE_INTERFACES_FILE_SHARE_TAIHE_ANI_CONSTRUCTOR_H diff --git a/interfaces/kits/taihe/fileshare/src/grant_permissons.cpp b/interfaces/kits/taihe/fileshare/src/grant_permissons.cpp new file mode 100644 index 0000000000000000000000000000000000000000..47477fb714b43c1ee7b34babea037e167cd65979 --- /dev/null +++ b/interfaces/kits/taihe/fileshare/src/grant_permissons.cpp @@ -0,0 +1,106 @@ +/* +* 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 "grant_permissons.h" +#include "log.h" +#include "oh_file_share.h" +#include + +namespace ANI::FileShare { + +ohos::fileshare::PolicyInfo makePolicyInfo(taihe::string_view uri, int32_t operationMode) +{ + return {uri, operationMode}; +} + +int32_t getUriPoliciesArg(taihe::array_view policies, + std::vector &uriPolicies) +{ + uint32_t count = policies.size(); + if (count > OHOS::AppFileService::MAX_ARRAY_SIZE) { + LOGE("The length of the array is extra-long"); + return E_PARAMS; + } + for (uint32_t i = 0; i < count; i++) { + OHOS::AppFileService::UriPolicyInfo uriPolicy; + uriPolicy.uri = policies[i].uri; + uriPolicy.mode = policies[i].operationMode; + if (uriPolicy.uri == "") { + LOGE("URI is empty"); + return E_PARAMS; + } + if (uriPolicy.mode != READ_MODE && + uriPolicy.mode != (READ_MODE | WRITE_MODE)) { + LOGE("Invalid operation mode"); + return E_PARAMS; + } + uriPolicies.emplace_back(uriPolicy); + } + return E_NO_ERROR; +} + +void activatePermissionSync(taihe::array_view policies) +{ + std::vector uriPolicies; + if (getUriPoliciesArg(policies, uriPolicies)) { + LOGE("Failed to get URI policies"); + taihe::set_business_error(E_PARAMS, "Failed to get URI policies"); + return ; + } + + std::shared_ptr arg = std::make_shared(); + if (arg == nullptr) { + LOGE("PolicyErrorArgs make make_shared failed"); + taihe::set_business_error(E_UNKNOWN_ERROR, "PolicyErrorArgs make make_shared failed"); + return ; + } + + arg->errNo = OHOS::AppFileService::FilePermission::ActivatePermission(uriPolicies, arg->errorResults); + if (arg->errNo) { + LOGE("Activation failed"); + taihe::set_business_error(arg->errNo, "Activation failed"); + } +} + +void deactivatePermissionSync(taihe::array_view policies) +{ + std::vector uriPolicies; + if (getUriPoliciesArg(policies, uriPolicies)) { + LOGE("Failed to get URI policies"); + taihe::set_business_error(E_PARAMS, "Failed to get URI policies"); + return ; + } + + std::shared_ptr arg = std::make_shared(); + if (arg == nullptr) { + LOGE("PolicyErrorArgs make make_shared failed"); + taihe::set_business_error(E_UNKNOWN_ERROR, "PolicyErrorArgs make make_shared failed"); + return ; + } + + arg->errNo = OHOS::AppFileService::FilePermission::DeactivatePermission(uriPolicies, arg->errorResults); + if (arg->errNo) { + LOGE("Deactivation failed"); + taihe::set_business_error(arg->errNo, "Deactivation failed"); + return ; + } +} +} // namespace ANI::FileShare + +// NOLINTBEGIN +TH_EXPORT_CPP_API_makePolicyInfo(ANI::FileShare::makePolicyInfo); +TH_EXPORT_CPP_API_activatePermissionSync(ANI::FileShare::activatePermissionSync); +TH_EXPORT_CPP_API_deactivatePermissionSync(ANI::FileShare::deactivatePermissionSync); + // NOLINTEND diff --git a/interfaces/kits/taihe/fileuri/BUILD.gn b/interfaces/kits/taihe/fileuri/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..06cf3c6a7b85b4ed59707294e11b3fa8171d1864 --- /dev/null +++ b/interfaces/kits/taihe/fileuri/BUILD.gn @@ -0,0 +1,98 @@ +# 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. + +import("//build/config/components/ets_frontend/ets2abc_config.gni") +import("//build/ohos.gni") +import("//build/ohos/taihe_idl/taihe.gni") +import("//foundation/filemanagement/app_file_service/app_file_service.gni") + +part_name = "app_file_service" +subsystem_name = "filemanagement" +taihe_generated_file_path = "$taihe_file_path/out/$subsystem_name/$part_name/fileuri" + +copy_taihe_idl("copy_taihe") { + sources = [ "${app_file_service_path}/interfaces/kits/taihe/fileuri/idl/ohos.file.fileuri.taihe" ] +} + +ohos_taihe("run_taihe") { + taihe_generated_file_path = "$taihe_generated_file_path" + deps = [ ":copy_taihe" ] + outputs = [ + "$taihe_generated_file_path/src/ohos.file.fileuri.ani.cpp", + "$taihe_generated_file_path/src/ohos.file.fileuri.abi.c", + ] +} + +taihe_shared_library("file_fileuri_taihe") { + taihe_generated_file_path = "$taihe_generated_file_path" + subsystem_name = "$subsystem_name" + part_name = "$part_name" + + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + + include_dirs = [ + "include", + "${app_file_service_path}/interfaces/common/include", + "${app_file_service_path}/interfaces/common/include/log.h", + "${app_file_service_path}/interfaces/innerkits/native/file_uri/include", + "${app_file_service_path}/interfaces/kits/ndk/fileshare/include" + ] + + sources = get_target_outputs(":run_taihe") + sources += [ + "src/ani_constructor.cpp", + "src/fileuri_taihe.cpp" + ] + + deps = [ + ":run_taihe", + "${app_file_service_path}/interfaces/innerkits/native:fileuri_native", + ] + + external_deps = [ + "hilog:libhilog", + "ability_base:zuri", + ] +} + +generate_static_abc("file_fileuri_taihe_abc") { + base_url = "$taihe_generated_file_path" + files = [ "$taihe_generated_file_path/@ohos.file.fileuri.ets" ] + is_boot_abc = "True" + device_dst_file = "/system/framework/file_fileuri_taihe_abc.abc" + dependencies = [ ":run_taihe" ] +} + +ohos_prebuilt_etc("file_fileuri_etc") { + source = "$target_out_dir/file_fileuri_taihe_abc.abc" + module_install_dir = "framework" + part_name = "app_file_service" + subsystem_name = "filemanagement" + deps = [ + ":file_fileuri_taihe_abc", + ] +} + +group("afs_fileuri_taihe") { + deps = [ + ":file_fileuri_taihe", + ":file_fileuri_etc", + ] +} diff --git a/interfaces/kits/taihe/fileuri/idl/ohos.file.fileuri.taihe b/interfaces/kits/taihe/fileuri/idl/ohos.file.fileuri.taihe new file mode 100644 index 0000000000000000000000000000000000000000..b2c25a8481a8a97a545e1b760ee18586f1f1af1b --- /dev/null +++ b/interfaces/kits/taihe/fileuri/idl/ohos.file.fileuri.taihe @@ -0,0 +1,31 @@ +/* +* 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. +*/ + +@!namespace("@ohos.file.fileuri", "fileUri") + +@!sts_inject(""" +static { loadLibrary("file_fileuri_taihe.z"); } +""") + +@class +interface FileUri { + @get("name") + getName(): String; +} + +@ctor("FileUri") +function makeFileUri(name: String): FileUri; + +function getUriFromPath(path: String): String; diff --git a/interfaces/kits/taihe/fileuri/include/fileuri_taihe.h b/interfaces/kits/taihe/fileuri/include/fileuri_taihe.h new file mode 100644 index 0000000000000000000000000000000000000000..07658dc5371c17b37541a87b609bc5fe1aab1712 --- /dev/null +++ b/interfaces/kits/taihe/fileuri/include/fileuri_taihe.h @@ -0,0 +1,45 @@ +/* + * 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_TAIHE_INCLUDE_FILEURI_TAIHE_H +#define INTERFACES_KITS_TAIHE_INCLUDE_FILEURI_TAIHE_H + +#include +#include "ohos.file.fileuri.proj.hpp" +#include "ohos.file.fileuri.impl.hpp" +#include "taihe/runtime.hpp" +#include "file_uri.h" + +namespace ANI::FileUri { + +class FileUriImpl { +public: + FileUriImpl() = delete; + + FileUriImpl(taihe::string_view name); + + std::string getName(); + +private: + OHOS::Uri uri_; +}; + +ohos::file::fileuri::FileUri makeFileUri(taihe::string_view name); + +std::string getUriFromPath(taihe::string_view path); + +} + +#endif // INTERFACES_KITS_TAIHE_INCLUDE_FILEURI_TAIHE_H diff --git a/interfaces/kits/taihe/fileuri/src/ani_constructor.cpp b/interfaces/kits/taihe/fileuri/src/ani_constructor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c68f4de4a6a049260eff31f5e25ceca17c113e4d --- /dev/null +++ b/interfaces/kits/taihe/fileuri/src/ani_constructor.cpp @@ -0,0 +1,29 @@ +/* + * 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 "ohos.file.fileuri.ani.hpp" +ANI_EXPORT ani_status ANI_Constructor(ani_vm *vm, uint32_t *result) +{ + ani_env *env; + if (ANI_OK != vm->GetEnv(ANI_VERSION_1, &env)) { + return ANI_ERROR; + } + if (ANI_OK != ohos::file::fileuri::ANIRegister(env)) { + std::cerr << "Error from ohos::file::fileuri::ANIRegister" << std::endl; + return ANI_ERROR; + } + *result = ANI_VERSION_1; + return ANI_OK; +} diff --git a/interfaces/kits/taihe/fileuri/src/fileuri_taihe.cpp b/interfaces/kits/taihe/fileuri/src/fileuri_taihe.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ac9cedf5a0b7e244ac358419fca17009fc002e97 --- /dev/null +++ b/interfaces/kits/taihe/fileuri/src/fileuri_taihe.cpp @@ -0,0 +1,60 @@ +/* + * 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 "fileuri_taihe.h" + +#include "common_func.h" +#include "sandbox_helper.h" + +namespace ANI::FileUri { + +const std::string FILE_SCHEME_PREFIX_TAIHE = "file://"; +const std::string FILE_FILEURI_FAILED = ""; + +FileUriImpl::FileUriImpl(taihe::string_view name) + : uri_((std::string(name.c_str()).find(FILE_SCHEME_PREFIX_TAIHE) == 0) ? std::string(name.c_str()) + : OHOS::AppFileService::CommonFunc::GetUriFromPath(std::string(name.c_str()))) +{ +} + +std::string FileUriImpl::getName() +{ + std::string sandboxPath = OHOS::AppFileService::SandboxHelper::Decode(uri_.GetPath()); + size_t posLast = sandboxPath.find_last_of("/"); + if (posLast == std::string::npos) { + return FILE_FILEURI_FAILED; + } + if (posLast == (sandboxPath.size() - 1)) { + return FILE_FILEURI_FAILED; + } + return sandboxPath.substr(posLast + 1); +} + + +ohos::file::fileuri::FileUri makeFileUri(taihe::string_view name) +{ + return taihe::make_holder(name); +} + +std::string getUriFromPath(taihe::string_view path) +{ + const std::string strPath = path.c_str(); + std::string uri = OHOS::AppFileService::CommonFunc::GetUriFromPath(strPath); + return uri; +} +} // namespace ANI::FileUri + +TH_EXPORT_CPP_API_makeFileUri(ANI::FileUri::makeFileUri); +TH_EXPORT_CPP_API_getUriFromPath(ANI::FileUri::getUriFromPath);