1// Windows/FileName.h 2 3#ifndef __WINDOWS_FILE_NAME_H 4#define __WINDOWS_FILE_NAME_H 5 6#include "../Common/MyString.h" 7 8namespace NWindows { 9namespace NFile { 10namespace NName { 11 12void NormalizeDirPathPrefix(FString &dirPath); // ensures that it ended with '\\', if dirPath is not epmty 13void NormalizeDirPathPrefix(UString &dirPath); 14 15#ifdef _WIN32 16 17extern const wchar_t *kSuperPathPrefix; /* \\?\ */ 18const unsigned kDevicePathPrefixSize = 4; 19const unsigned kSuperPathPrefixSize = 4; 20const unsigned kSuperUncPathPrefixSize = kSuperPathPrefixSize + 4; 21 22bool IsDevicePath(CFSTR s) throw(); /* \\.\ */ 23bool IsSuperUncPath(CFSTR s) throw(); 24 25bool IsDrivePath(const wchar_t *s) throw(); 26bool IsSuperPath(const wchar_t *s) throw(); 27bool IsSuperOrDevicePath(const wchar_t *s) throw(); 28 29#ifndef USE_UNICODE_FSTRING 30bool IsDrivePath(CFSTR s) throw(); 31bool IsSuperPath(CFSTR s) throw(); 32bool IsSuperOrDevicePath(CFSTR s) throw(); 33#endif 34 35#endif // _WIN32 36 37bool IsAbsolutePath(const wchar_t *s) throw(); 38unsigned GetRootPrefixSize(const wchar_t *s) throw(); 39 40#ifdef WIN_LONG_PATH 41 42const int kSuperPathType_UseOnlyMain = 0; 43const int kSuperPathType_UseOnlySuper = 1; 44const int kSuperPathType_UseMainAndSuper = 2; 45 46int GetUseSuperPathType(CFSTR s) throw(); 47bool GetSuperPath(CFSTR path, UString &longPath, bool onlyIfNew); 48bool GetSuperPaths(CFSTR s1, CFSTR s2, UString &d1, UString &d2, bool onlyIfNew); 49 50#define USE_MAIN_PATH (__useSuperPathType != kSuperPathType_UseOnlySuper) 51#define USE_MAIN_PATH_2 (__useSuperPathType1 != kSuperPathType_UseOnlySuper && __useSuperPathType2 != kSuperPathType_UseOnlySuper) 52 53#define USE_SUPER_PATH (__useSuperPathType != kSuperPathType_UseOnlyMain) 54#define USE_SUPER_PATH_2 (__useSuperPathType1 != kSuperPathType_UseOnlyMain || __useSuperPathType2 != kSuperPathType_UseOnlyMain) 55 56#define IF_USE_MAIN_PATH int __useSuperPathType = GetUseSuperPathType(path); if (USE_MAIN_PATH) 57#define IF_USE_MAIN_PATH_2(x1, x2) \ 58 int __useSuperPathType1 = GetUseSuperPathType(x1); \ 59 int __useSuperPathType2 = GetUseSuperPathType(x2); \ 60 if (USE_MAIN_PATH_2) 61 62#else 63 64#define IF_USE_MAIN_PATH 65#define IF_USE_MAIN_PATH_2(x1, x2) 66 67#endif // WIN_LONG_PATH 68 69bool GetFullPath(CFSTR dirPrefix, CFSTR path, FString &fullPath); 70bool GetFullPath(CFSTR path, FString &fullPath); 71 72}}} 73 74#endif 75