diff options
Diffstat (limited to '3rdparty/lzma/CPP/Windows/FileDir.h')
-rw-r--r-- | 3rdparty/lzma/CPP/Windows/FileDir.h | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/3rdparty/lzma/CPP/Windows/FileDir.h b/3rdparty/lzma/CPP/Windows/FileDir.h index e43c19bd8a6..b13d1ccada2 100644 --- a/3rdparty/lzma/CPP/Windows/FileDir.h +++ b/3rdparty/lzma/CPP/Windows/FileDir.h @@ -4,27 +4,36 @@ #define __WINDOWS_FILE_DIR_H #include "../Common/MyString.h" + #include "FileIO.h" namespace NWindows { namespace NFile { -namespace NDirectory { +namespace NDir { + +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); -#ifdef WIN_LONG_PATH -bool GetLongPaths(CFSTR s1, CFSTR s2, UString &d1, UString &d2); +#ifndef UNDER_CE +bool MyCreateHardLink(CFSTR newFileName, CFSTR existFileName); #endif -bool MyGetWindowsDirectory(FString &path); -bool MyGetSystemDirectory(FString &path); +bool RemoveDir(CFSTR path); +bool CreateDir(CFSTR path); + +/* CreateComplexDir returns true, if directory can contain files after the call (two cases): + 1) the directory already exists (network shares and drive paths are supported) + 2) the directory was created + path can be WITH or WITHOUT trailing path separator. */ + +bool CreateComplexDir(CFSTR 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 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 +41,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 +76,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 |