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 16 #ifndef INTERFACES_KITS_NATIVE_SRC_TRASH_FILE_TRASH_N_EXPORTER_H 17 #define INTERFACES_KITS_NATIVE_SRC_TRASH_FILE_TRASH_N_EXPORTER_H 18 19 #include "uv.h" 20 21 #include "filemgmt_libn.h" 22 #include "napi/native_api.h" 23 #include "napi/native_node_api.h" 24 25 namespace OHOS { 26 namespace Trash { 27 using namespace FileManagement::LibN; 28 using namespace std; 29 // 暂时默认用户100 30 const std::string TRASH_PATH = "/storage/.Trash/Users/100"; 31 const std::string URI_PATH_PREFIX = "file://docs"; 32 const std::string TRASH_SUB_DIR = "oh_trash_content"; 33 34 /** 35 * Indicates the supported capabilities of the file or directory. 36 */ 37 const int32_t REPRESENTS_FILE = 1; 38 const int32_t REPRESENTS_DIR = 1 << 1; 39 const int32_t SUPPORTS_READ = 1 << 2; 40 const int32_t SUPPORTS_WRITE = 1 << 3; 41 42 class FileTrashNExporter final : public NExporter { 43 public: 44 inline static const std::string className_ = "trash"; 45 46 static napi_value ListFile(napi_env env, napi_callback_info info); 47 static napi_value Recover(napi_env env, napi_callback_info info); 48 static napi_value CompletelyDelete(napi_env env, napi_callback_info info); 49 50 bool Export() override; 51 std::string GetClassName() override; 52 FileTrashNExporter(napi_env env, napi_value exports); 53 ~FileTrashNExporter() override; 54 }; 55 56 } // namespace Trash 57 } // namespace OHOS 58 #endif // INTERFACES_KITS_NATIVE_SRC_TRASH_FILE_TRASH_N_EXPORTER_H