-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathccfilewin32.h
More file actions
79 lines (72 loc) · 2.25 KB
/
ccfilewin32.h
File metadata and controls
79 lines (72 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include "ccfilestrategy.h"
#include "platformconfig.h"
#if CCTARGET_PLATFORM == CCPLATFORM_WIN32
#include <errno.h>
#include <io.h>
#include <direct.h>
#include <deque>
#include <stack>
enum FileAccess
{
//文件存在
EXISTENCEONLY = 0x00,
//文件可写
WRITEPERMISSION = 0x02,
//文件只读
READPERMISSION = 0x04,
//文件可读写
READANDWRITEPERMISSION = 0x06,
//下面两项主要是为了设置文件权限, 所有文件皆有可读权限,因此S_CANWRITE 等于 S_CANREAD|S_CANWRITE
S_CANREAD = 0x0100,
S_CANWRITE = 0x0080
};
class CC_file_win32 : public CC_file_strategy
{
public:
void Create(std::string path)override;
intptr_t Copy(std::string sourcePath, std::string destPath)override;
void Delete(std::string path)override;
bool Exists(std::string path)override;
bool CanRead(std::string path)override;
bool CanWrite(std::string path)override;
bool CanExecute(std::string path)override;
//************************************
// @Method: GetAccessControl
// @Returns: FileAccess
// @Parameter: path
// @Brief: 取得指定文件访问权限
//************************************
FileAccess GetAccessControl(std::string path);
//************************************
// @Method: GetAttributes
// @Returns: FileAttributes
// @Parameter: path
// @Brief: 获取指定路径文件的属性
//************************************
FileAttributes GetAttributes(std::string path);
//************************************
// @Method: GetCreateTime
// @Returns: DateTime
// @Parameter: path
// @Brief: 获取指定文件创建时间。
//************************************
DateTime GetCreateTime(std::string path);
//************************************
// @Method: GetLastAccessTime
// @Returns: DateTime
// @Parameter: path
// @Brief: 获取指定文件最后一次访问时间。
//************************************
DateTime GetLastAccessTime(std::string path);
//************************************
// @Method: GetLastModifyTime
// @Returns: DateTime
// @Parameter: path
// @Brief: 获取文件最后一次修改时间。
//************************************
DateTime GetLastModifyTime(std::string path);
private:
static long CopyFileData(FileStream* src, FileStream* dest);
};
#endif