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_MOVEDIR_H 17 #define INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_MOVEDIR_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 DIRMODE_MIN = 0; 28 constexpr int DIRMODE_MAX = 3; 29 30 constexpr int FILE_DISMATCH = 0; 31 constexpr int FILE_MATCH = 1; 32 constexpr int MOVEDIR_DEFAULT_PERM = 0770; 33 34 const double NS = 1e9; 35 36 enum ModeOfMoveDir { 37 DIRMODE_DIRECTORY_THROW_ERR = 0, 38 DIRMODE_FILE_THROW_ERR, 39 DIRMODE_FILE_REPLACE, 40 DIRMODE_DIRECTORY_REPLACE 41 }; 42 43 class MoveDir final { 44 public: 45 static napi_value Sync(napi_env env, napi_callback_info info); 46 static napi_value Async(napi_env env, napi_callback_info info); 47 }; 48 49 struct ErrFiles { 50 std::string srcFiles; 51 std::string destFiles; ErrFilesErrFiles52 ErrFiles(const std::string& src, const std::string& dest) : srcFiles(src), destFiles(dest) {} 53 ~ErrFiles() = default; 54 }; 55 56 const std::string PROCEDURE_MOVEDIR_NAME = "FileIOMoveDir"; 57 } // namespace ModuleFileIO 58 } // namespace FileManagement 59 } // namespace OHOS 60 #endif // INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_MOVEDIR_H