This commit is contained in:
Igor Pavlov
2014-11-23 00:00:00 +00:00
committed by Kornel Lesiński
parent 83f8ddcc5b
commit f08f4dcc3c
1158 changed files with 76451 additions and 35082 deletions
Executable → Regular
+40 -15
View File
@@ -4,27 +4,29 @@
#define __WINDOWS_FILE_DIR_H
#include "../Common/MyString.h"
#include "FileIO.h"
namespace NWindows {
namespace NFile {
namespace NDirectory {
namespace NDir {
#ifdef WIN_LONG_PATH
bool GetLongPaths(CFSTR s1, CFSTR s2, UString &d1, UString &d2);
bool GetWindowsDir(FString &path);
bool GetSystemDir(FString &path);
bool SetDirTime(CFSTR path, const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime);
bool SetFileAttrib(CFSTR path, DWORD attrib);
bool MyMoveFile(CFSTR existFileName, CFSTR newFileName);
#ifndef UNDER_CE
bool MyCreateHardLink(CFSTR newFileName, CFSTR existFileName);
#endif
bool MyGetWindowsDirectory(FString &path);
bool MyGetSystemDirectory(FString &path);
bool SetDirTime(CFSTR fileName, const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime);
bool MySetFileAttributes(CFSTR fileName, DWORD fileAttributes);
bool MyMoveFile(CFSTR existFileName, CFSTR newFileName);
bool MyRemoveDirectory(CFSTR path);
bool MyCreateDirectory(CFSTR path);
bool CreateComplexDirectory(CFSTR path);
bool RemoveDir(CFSTR path);
bool CreateDir(CFSTR path);
bool CreateComplexDir(CFSTR path);
bool DeleteFileAlways(CFSTR name);
bool RemoveDirectoryWithSubItems(const FString &path);
bool RemoveDirWithSubItems(const FString &path);
bool MyGetFullPathName(CFSTR path, FString &resFullPath);
bool GetFullPathAndSplit(CFSTR path, FString &resDirPrefix, FString &resFileName);
@@ -32,8 +34,8 @@ bool GetOnlyDirPrefix(CFSTR path, FString &resDirPrefix);
#ifndef UNDER_CE
bool MySetCurrentDirectory(CFSTR path);
bool MyGetCurrentDirectory(FString &resultPath);
bool SetCurrentDir(CFSTR path);
bool GetCurrentDir(FString &resultPath);
#endif
@@ -67,6 +69,29 @@ public:
bool Remove();
};
#if !defined(UNDER_CE)
class CCurrentDirRestorer
{
FString _path;
public:
bool NeedRestore;
CCurrentDirRestorer(): NeedRestore(true)
{
GetCurrentDir(_path);
}
~CCurrentDirRestorer()
{
if (!NeedRestore)
return;
FString s;
if (GetCurrentDir(s))
if (s != _path)
SetCurrentDir(_path);
}
};
#endif
}}}
#endif