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_JS_SRC_MOD_FS_PROPERTIES_COPYDIR_H 17 #define INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_COPYDIR_H 18 19 #include <string> 20 21 #include "filemgmt_libn.h" 22 23 namespace OHOS { 24 namespace FileManagement { 25 namespace ModuleFileIO { 26 27 constexpr int COPYMODE_MIN = 0; 28 constexpr int COPYMODE_MAX = 1; 29 constexpr int COPYDIR_DEFAULT_PERM = 0770; 30 31 constexpr int DISMATCH = 0; 32 constexpr int MATCH = 1; 33 34 enum ModeOfCopyDir { 35 DIRMODE_FILE_COPY_THROW_ERR = 0, 36 DIRMODE_FILE_COPY_REPLACE 37 }; 38 39 class CopyDir final { 40 public: 41 static napi_value Sync(napi_env env, napi_callback_info info); 42 static napi_value Async(napi_env env, napi_callback_info info); 43 }; 44 45 struct ConflictFiles { 46 std::string srcFiles; 47 std::string destFiles; ConflictFilesConflictFiles48 ConflictFiles(const std::string& src, const std::string& dest) : srcFiles(src), destFiles(dest) {} 49 ~ConflictFiles() = default; 50 }; 51 52 const std::string PROCEDURE_COPYDIR_NAME = "FileIOCopyDir"; 53 } // namespace ModuleFileIO 54 } // namespace FileManagement 55 } // namespace OHOS 56 #endif // INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_COPYDIR_H