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 enum ModeOfMoveDir {
35     DIRMODE_DIRECTORY_THROW_ERR = 0,
36     DIRMODE_FILE_THROW_ERR,
37     DIRMODE_FILE_REPLACE,
38     DIRMODE_DIRECTORY_REPLACE
39 };
40 
41 class MoveDir final {
42 public:
43     static napi_value Sync(napi_env env, napi_callback_info info);
44     static napi_value Async(napi_env env, napi_callback_info info);
45 };
46 
47 struct ErrFiles {
48     std::string srcFiles;
49     std::string destFiles;
ErrFilesErrFiles50     ErrFiles(const std::string& src, const std::string& dest) : srcFiles(src), destFiles(dest) {}
51     ~ErrFiles() = default;
52 };
53 
54 const std::string PROCEDURE_MOVEDIR_NAME = "FileIOMoveDir";
55 } // namespace ModuleFileIO
56 } // namespace FileManagement
57 } // namespace OHOS
58 #endif // INTERFACES_KITS_JS_SRC_MOD_FS_PROPERTIES_MOVEDIR_H