1 /* 2 * Copyright (c) 2023 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 #ifndef INTERFACES_KITS_NATIVE_RECENT_RECENT_N_EXPOTER_H 16 #define INTERFACES_KITS_NATIVE_RECENT_RECENT_N_EXPOTER_H 17 18 #include <dirent.h> 19 20 #include "filemgmt_libn.h" 21 22 namespace OHOS { 23 namespace FileManagement { 24 namespace Recent { 25 struct NameListArg { 26 struct dirent** namelist = { nullptr }; 27 int direntNum = 0; 28 }; 29 30 class RecentNExporter final : public LibN::NExporter { 31 public: 32 inline static const std::string className = "Recent"; 33 34 bool Export() override; 35 std::string GetClassName() override; 36 37 static napi_value AddRecentFile(napi_env env, napi_callback_info cbinfo); 38 static napi_value RemoveRecentFile(napi_env env, napi_callback_info cbinfo); 39 static napi_value ListRecentFile(napi_env env, napi_callback_info cbinfo); 40 41 RecentNExporter(napi_env env, napi_value exports); 42 ~RecentNExporter() override; 43 }; 44 45 const std::string RECENT_PATH = "/storage/.Recent/Users/100/"; 46 const std::string FILE_ACCESS_PERMISSION = "ohos.permission.FILE_ACCESS_MANAGER"; 47 constexpr int BUF_SIZE = 1024; 48 constexpr int MAX_RECENT_SIZE = 100; 49 } // namespace RecentNExporter 50 } // namespace FileManagement 51 } // namespace OHOS 52 #endif // INTERFACES_KITS_JS_RECENT_RECENT_N_EXPOTER_H 53