diff options
Diffstat (limited to 'CPP/Windows/FileDir.h')
-rw-r--r-- | CPP/Windows/FileDir.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/CPP/Windows/FileDir.h b/CPP/Windows/FileDir.h index 573ffa2..9ba98fc 100644 --- a/CPP/Windows/FileDir.h +++ b/CPP/Windows/FileDir.h | |||
@@ -18,9 +18,20 @@ bool GetSystemDir(FString &path); | |||
18 | WIN32 API : SetFileTime() doesn't allow to set zero timestamps in file | 18 | WIN32 API : SetFileTime() doesn't allow to set zero timestamps in file |
19 | but linux : allows unix time = 0 in filesystem | 19 | but linux : allows unix time = 0 in filesystem |
20 | */ | 20 | */ |
21 | 21 | /* | |
22 | SetDirTime() can be used to set time for file or for dir. | ||
23 | If path is symbolic link, SetDirTime() will follow symbolic link, | ||
24 | and it will set timestamps of symbolic link's target file or dir. | ||
25 | */ | ||
22 | bool SetDirTime(CFSTR path, const CFiTime *cTime, const CFiTime *aTime, const CFiTime *mTime); | 26 | bool SetDirTime(CFSTR path, const CFiTime *cTime, const CFiTime *aTime, const CFiTime *mTime); |
23 | 27 | ||
28 | /* | ||
29 | SetLinkFileTime() doesn't follow symbolic link, | ||
30 | and it sets timestamps for symbolic link file itself. | ||
31 | If (path) is not symbolic link, it still can work (at least in some new OS versions). | ||
32 | */ | ||
33 | bool SetLinkFileTime(CFSTR path, const CFiTime *cTime, const CFiTime *aTime, const CFiTime *mTime); | ||
34 | |||
24 | 35 | ||
25 | #ifdef _WIN32 | 36 | #ifdef _WIN32 |
26 | 37 | ||
@@ -41,7 +52,26 @@ int my_chown(CFSTR path, uid_t owner, gid_t group); | |||
41 | bool SetFileAttrib_PosixHighDetect(CFSTR path, DWORD attrib); | 52 | bool SetFileAttrib_PosixHighDetect(CFSTR path, DWORD attrib); |
42 | 53 | ||
43 | 54 | ||
55 | #ifndef _WIN32 | ||
56 | #define PROGRESS_CONTINUE 0 | ||
57 | #define PROGRESS_CANCEL 1 | ||
58 | // #define PROGRESS_STOP 2 | ||
59 | // #define PROGRESS_QUIET 3 | ||
60 | #endif | ||
61 | Z7_PURE_INTERFACES_BEGIN | ||
62 | DECLARE_INTERFACE(ICopyFileProgress) | ||
63 | { | ||
64 | // in: total, current: include all/processed alt streams. | ||
65 | // it returns PROGRESS_CONTINUE or PROGRESS_CANCEL. | ||
66 | virtual DWORD CopyFileProgress(UInt64 total, UInt64 current) = 0; | ||
67 | }; | ||
68 | Z7_PURE_INTERFACES_END | ||
69 | |||
44 | bool MyMoveFile(CFSTR existFileName, CFSTR newFileName); | 70 | bool MyMoveFile(CFSTR existFileName, CFSTR newFileName); |
71 | // (progress == NULL) is allowed | ||
72 | bool MyMoveFile_with_Progress(CFSTR oldFile, CFSTR newFile, | ||
73 | ICopyFileProgress *progress); | ||
74 | |||
45 | 75 | ||
46 | #ifndef UNDER_CE | 76 | #ifndef UNDER_CE |
47 | bool MyCreateHardLink(CFSTR newFileName, CFSTR existFileName); | 77 | bool MyCreateHardLink(CFSTR newFileName, CFSTR existFileName); |
@@ -59,6 +89,11 @@ bool CreateComplexDir(CFSTR path); | |||
59 | 89 | ||
60 | bool DeleteFileAlways(CFSTR name); | 90 | bool DeleteFileAlways(CFSTR name); |
61 | bool RemoveDirWithSubItems(const FString &path); | 91 | bool RemoveDirWithSubItems(const FString &path); |
92 | #ifdef _WIN32 | ||
93 | bool RemoveDirAlways_if_Empty(const FString &path); | ||
94 | #else | ||
95 | #define RemoveDirAlways_if_Empty RemoveDir | ||
96 | #endif | ||
62 | 97 | ||
63 | bool MyGetFullPathName(CFSTR path, FString &resFullPath); | 98 | bool MyGetFullPathName(CFSTR path, FString &resFullPath); |
64 | bool GetFullPathAndSplit(CFSTR path, FString &resDirPrefix, FString &resFileName); | 99 | bool GetFullPathAndSplit(CFSTR path, FString &resDirPrefix, FString &resFileName); |
@@ -87,7 +122,9 @@ public: | |||
87 | bool Create(CFSTR pathPrefix, NIO::COutFile *outFile); // pathPrefix is not folder prefix | 122 | bool Create(CFSTR pathPrefix, NIO::COutFile *outFile); // pathPrefix is not folder prefix |
88 | bool CreateRandomInTempFolder(CFSTR namePrefix, NIO::COutFile *outFile); | 123 | bool CreateRandomInTempFolder(CFSTR namePrefix, NIO::COutFile *outFile); |
89 | bool Remove(); | 124 | bool Remove(); |
90 | bool MoveTo(CFSTR name, bool deleteDestBefore); | 125 | // bool MoveTo(CFSTR name, bool deleteDestBefore); |
126 | bool MoveTo(CFSTR name, bool deleteDestBefore, | ||
127 | ICopyFileProgress *progress); | ||
91 | }; | 128 | }; |
92 | 129 | ||
93 | 130 | ||