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 inline static std::string recentPath_ {}; 34 static void InitRecentPath(); 35 36 bool Export() override; 37 std::string GetClassName() override; 38 39 static napi_value AddRecentFile(napi_env env, napi_callback_info cbinfo); 40 static napi_value RemoveRecentFile(napi_env env, napi_callback_info cbinfo); 41 static napi_value ListRecentFile(napi_env env, napi_callback_info cbinfo); 42 43 RecentNExporter(napi_env env, napi_value exports); 44 ~RecentNExporter() override; 45 }; 46 47 // const std::string RECENT_PATH = "/storage/Users/.Recent/"; 48 const std::string FILE_ACCESS_PERMISSION = "ohos.permission.FILE_ACCESS_MANAGER"; 49 constexpr int BUF_SIZE = 1024; 50 constexpr int MAX_RECENT_SIZE = 100; 51 } // namespace RecentNExporter 52 } // namespace FileManagement 53 } // namespace OHOS 54 #endif // INTERFACES_KITS_JS_RECENT_RECENT_N_EXPOTER_H 55