• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include "module.h"
16 
17 #include <memory>
18 #include <vector>
19 
20 #include "../common/log.h"
21 #include "file_picker_exporter.h"
22 
23 using namespace std;
24 
25 namespace OHOS {
26 namespace DistributedFS {
27 namespace ModuleFPExpoter {
Export(napi_env env,napi_value exports)28 static napi_value Export(napi_env env, napi_value exports)
29 {
30     std::vector<std::unique_ptr<OHOS::DistributedFS::NExporter>> products;
31     products.emplace_back(make_unique<FilePickerExporter>(env, exports));
32 
33     for (auto &&product : products) {
34         if (!product->Export()) {
35             HILOGE("INNER BUG. Failed to export class %{public}s for module filepicker",
36                    product->GetClassName().c_str());
37             return nullptr;
38         } else {
39             HILOGE("Class %{public}s for module file has been exported", product->GetClassName().c_str());
40         }
41     }
42     return exports;
43 }
44 
45 NAPI_MODULE(filepicker, Export)
46 } // namespace ModuleFMSExpoter
47 } // namespace DistributedFS
48 } // namespace OHOS