diff options
Diffstat (limited to 'CPP/Windows/FileDir.h')
-rw-r--r--[-rwxr-xr-x] | CPP/Windows/FileDir.h | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/CPP/Windows/FileDir.h b/CPP/Windows/FileDir.h index e43c19bd..02d3e5a5 100755..100644 --- a/CPP/Windows/FileDir.h +++ b/CPP/Windows/FileDir.h @@ -4,27 +4,29 @@ #define __WINDOWS_FILE_DIR_H #include "../Common/MyString.h" + #include "FileIO.h" namespace NWindows { namespace NFile { -namespace NDirectory { - -#ifdef WIN_LONG_PATH -bool GetLongPaths(CFSTR s1, CFSTR s2, UString &d1, UString &d2); -#endif +namespace NDir { -bool MyGetWindowsDirectory(FString &path); -bool MyGetSystemDirectory(FString &path); +bool GetWindowsDir(FString &path); +bool GetSystemDir(FString &path); -bool SetDirTime(CFSTR fileName, const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime); -bool MySetFileAttributes(CFSTR fileName, DWORD fileAttributes); +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); -bool MyRemoveDirectory(CFSTR path); -bool MyCreateDirectory(CFSTR path); -bool CreateComplexDirectory(CFSTR path); + +#ifndef UNDER_CE +bool MyCreateHardLink(CFSTR newFileName, CFSTR existFileName); +#endif + +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 |