• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Windows/FileName.h
2 
3 #ifndef __WINDOWS_FILE_NAME_H
4 #define __WINDOWS_FILE_NAME_H
5 
6 #include "../Common/MyString.h"
7 
8 namespace NWindows {
9 namespace NFile {
10 namespace NName {
11 
12 void NormalizeDirPathPrefix(FString &dirPath); // ensures that it ended with '\\', if dirPath is not epmty
13 void NormalizeDirPathPrefix(UString &dirPath);
14 
15 #ifdef _WIN32
16 
17 extern const wchar_t *kSuperPathPrefix; /* \\?\ */
18 const unsigned kDevicePathPrefixSize = 4;
19 const unsigned kSuperPathPrefixSize = 4;
20 const unsigned kSuperUncPathPrefixSize = kSuperPathPrefixSize + 4;
21 
22 bool IsDevicePath(CFSTR s) throw(); /* \\.\ */
23 bool IsSuperUncPath(CFSTR s) throw();
24 
25 bool IsDrivePath(const wchar_t *s) throw();
26 bool IsSuperPath(const wchar_t *s) throw();
27 bool IsSuperOrDevicePath(const wchar_t *s) throw();
28 
29 #ifndef USE_UNICODE_FSTRING
30 bool IsDrivePath(CFSTR s) throw();
31 bool IsSuperPath(CFSTR s) throw();
32 bool IsSuperOrDevicePath(CFSTR s) throw();
33 #endif
34 
35 #endif // _WIN32
36 
37 bool IsAbsolutePath(const wchar_t *s) throw();
38 unsigned GetRootPrefixSize(const wchar_t *s) throw();
39 
40 #ifdef WIN_LONG_PATH
41 
42 const int kSuperPathType_UseOnlyMain = 0;
43 const int kSuperPathType_UseOnlySuper = 1;
44 const int kSuperPathType_UseMainAndSuper = 2;
45 
46 int GetUseSuperPathType(CFSTR s) throw();
47 bool GetSuperPath(CFSTR path, UString &longPath, bool onlyIfNew);
48 bool 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 
69 bool GetFullPath(CFSTR dirPrefix, CFSTR path, FString &fullPath);
70 bool GetFullPath(CFSTR path, FString &fullPath);
71 
72 }}}
73 
74 #endif
75