bool IsAltPathPrefix(CFSTR s) throw()
{ unsigned len = MyStringLen(s); if (len == 0) returnfalse; if (s[len - 1] != ':') returnfalse;
#ifdefined(_WIN32) && !defined(UNDER_CE) if (IsDevicePath(s)) returnfalse; if (IsSuperPath(s))
{
s += kSuperPathPrefixSize;
len -= kSuperPathPrefixSize;
} if (len == 2 && IsDrivePath2(s)) returnfalse; #endif
s = s; returnfalse; /* // actually we don't know the way to open device file in WinCE. unsignedlen=MyStringLen(s); if(len<5||len>5||!IsString1PrefixedByString2(s,"DSK")) returnfalse; if(s[4]!=':') returnfalse; // for reading use SG_REQ sg; if (DeviceIoControl(dsk, IOCTL_DISK_READ));
*/
#else
if (!IS_DEVICE_PATH(s)) returnfalse; unsigned len = MyStringLen(s); if (len == 6 && s[5] == ':') returntrue; if (len < 18 || len > 22 || !IsString1PrefixedByString2(s + kDevicePathPrefixSize, "PhysicalDrive")) returnfalse; for (unsigned i = 17; i < len; i++) if (s[i] < '0' || s[i] > '9') returnfalse; returntrue;
#endif
}
bool IsSuperUncPath(CFSTR s) throw() { return (IS_SUPER_PREFIX(s) && IS_UNC_WITH_SLASH(s + kSuperPathPrefixSize)); } bool IsNetworkPath(CFSTR s) throw()
{ if (!IS_SEPAR(s[0]) || !IS_SEPAR(s[1])) returnfalse; if (IsSuperUncPath(s)) returntrue;
FChar c = s[2]; return (c != '.' && c != '?');
}
unsigned GetNetworkServerPrefixSize(CFSTR s) throw()
{ if (!IS_SEPAR(s[0]) || !IS_SEPAR(s[1])) return0; unsigned prefixSize = 2; if (IsSuperUncPath(s))
prefixSize = kSuperUncPathPrefixSize; else
{
FChar c = s[2]; if (c == '.' || c == '?') return0;
} int pos = FindSepar(s + prefixSize); if (pos < 0) return0; return prefixSize + pos + 1;
}
bool IsNetworkShareRootPath(CFSTR s) throw()
{ unsigned prefixSize = GetNetworkServerPrefixSize(s); if (prefixSize == 0) returnfalse;
s += prefixSize; int pos = FindSepar(s); if (pos < 0) returntrue; return s[(unsigned)pos + 1] == 0;
}
int FindAltStreamColon(CFSTR path) throw()
{ unsigned i = 0; if (IsDrivePath2(path))
i = 2; int colonPos = -1; for (;; i++)
{
FChar c = path[i]; if (c == 0) return colonPos; if (c == ':')
{ if (colonPos < 0)
colonPos = i; continue;
} if (IS_SEPAR(c))
colonPos = -1;
}
}
#ifndef USE_UNICODE_FSTRING
staticunsigned GetRootPrefixSize_Of_NetworkPath(CFSTR s)
{ // Network path: we look "server\path\" as root prefix int pos = FindSepar(s); if (pos < 0) return0; int pos2 = FindSepar(s + (unsigned)pos + 1); if (pos2 < 0) return0; return pos + pos2 + 2;
}
for (unsigned i = 0;;)
{ constwchar_t c = s[i]; if (c == 0) returntrue; if (c == '.' && (i == 0 || IS_SEPAR(s[i - 1])))
{ constwchar_t c1 = s[i + 1]; if (c1 == '.')
{ constwchar_t c2 = s[i + 2]; if (IS_SEPAR(c2) || c2 == 0)
{ if (i == 0) returnfalse; int k = i - 2;
i += 2;
for (;; k--)
{ if (k < 0) returnfalse; if (!IS_SEPAR(s[(unsigned)k])) break;
}
do
k--; while (k >= 0 && !IS_SEPAR(s[(unsigned)k]));
unsigned num;
if (k >= 0)
{
num = i - k;
i = k;
} else
{
num = (c2 == 0 ? i : (i + 1));
i = 0;
}
s.Delete(i, num); continue;
}
} elseif (IS_SEPAR(c1) || c1 == 0)
{ unsigned num = 2; if (i != 0)
i--; elseif (c1 == 0)
num = 1;
s.Delete(i, num); continue;
}
}
UString rem = &temp[fixedSize]; if (!ResolveDotsFolders(rem)) returntrue;
temp.DeleteFrom(fixedSize);
res += temp;
res += rem;
#endif
returntrue;
}
if (IS_SEPAR(c))
{ if (IS_SEPAR(s[1]))
{
UString temp = fs2us(s + 2); unsigned fixedSize = GetRootPrefixSize_Of_NetworkPath(temp); // we ignore that error to allow short network paths server\share? /* if(fixedSize==0) returnfalse;
*/
UString rem = &temp[fixedSize]; if (!ResolveDotsFolders(rem)) returnfalse;
res += kSuperUncPrefix;
temp.DeleteFrom(fixedSize);
res += temp;
res += rem; returntrue;
}
} else
{ if (IsDrivePath2(s))
{
UString temp = fs2us(s); unsigned prefixSize = 2; if (IsDrivePath(s))
prefixSize = kDrivePrefixSize;
UString rem = temp.Ptr(prefixSize); if (!ResolveDotsFolders(rem)) returntrue;
res += kSuperPathPrefix;
temp.DeleteFrom(prefixSize);
res += temp;
res += rem; returntrue;
}
}
UString curDir; if (!GetCurDir(curDir)) returnfalse;
NormalizeDirPathPrefix(curDir);
bool GetSuperPath(CFSTR path, UString &superPath, bool onlyIfNew)
{ if (GetSuperPathBase(path, superPath))
{ if (superPath.IsEmpty())
{ // actually the only possible when onlyIfNew == true and superPath is empty // is case when
bool GetSuperPaths(CFSTR s1, CFSTR s2, UString &d1, UString &d2, bool onlyIfNew)
{ if (!GetSuperPathBase(s1, d1) ||
!GetSuperPathBase(s2, d2)) returnfalse; if (d1.IsEmpty() && d2.IsEmpty() && onlyIfNew) returnfalse; if (d1.IsEmpty()) d1 = fs2us(s1); if (d2.IsEmpty()) d2 = fs2us(s2); returntrue;
}
/* // returns true, if we need additional use with New Super path. boolGetSuperPath(CFSTRpath,UString&superPath) { if(GetSuperPathBase(path,superPath)) return!superPath.IsEmpty(); returnfalse; }
*/ #endif// WIN_LONG_PATH
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.