This commit is contained in:
Igor Pavlov
2016-09-29 00:00:00 +00:00
committed by Kornel Lesiński
parent 1eddf527ca
commit 232ce79574
83 changed files with 1088 additions and 307 deletions
+32 -27
View File
@@ -130,7 +130,10 @@ WinXP-64 FindFirstFile():
\\Server\ - ERROR_INVALID_NAME
\\Server\Share - ERROR_BAD_NETPATH
\\Server\Share - ERROR_BAD_NET_NAME (Win7)
\\Server\Share - ERROR_BAD_NET_NAME (Win7).
!!! There is problem : Win7 makes some requests for "\\Server\Shar" (look in Procmon),
when we call it for "\\Server\Share"
\\Server\Share\ - ERROR_FILE_NOT_FOUND
\\?\UNC\Server\Share - ERROR_INVALID_NAME
@@ -508,11 +511,10 @@ bool CFileInfo::Find(CFSTR path)
#endif
CFindFile finder;
if (finder.FindFirst(path, *this))
return true;
#if defined(_WIN32) && !defined(UNDER_CE)
{
/*
DWORD lastError = GetLastError();
if (lastError == ERROR_FILE_NOT_FOUND
|| lastError == ERROR_BAD_NETPATH // XP64: "\\Server\Share"
@@ -520,11 +522,26 @@ bool CFileInfo::Find(CFSTR path)
|| lastError == ERROR_INVALID_NAME // XP64: "\\?\UNC\Server\Share"
|| lastError == ERROR_BAD_PATHNAME // Win7: "\\?\UNC\Server\Share"
)
*/
unsigned rootSize = 0;
if (IsSuperPath(path))
rootSize = kSuperPathPrefixSize;
if (NName::IsDrivePath(path + rootSize) && path[rootSize + 3] == 0)
{
unsigned rootSize = 0;
if (IsSuperPath(path))
rootSize = kSuperPathPrefixSize;
if (IS_PATH_SEPAR(path[0]) && path[1] == 0)
DWORD attrib = GetFileAttrib(path);
if (attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
ClearBase();
Attrib = attrib;
Name = path + rootSize;
Name.DeleteFrom(2); // we don't need backslash (C:)
return true;
}
}
else if (IS_PATH_SEPAR(path[0]))
if (path[1] == 0)
{
DWORD attrib = GetFileAttrib(path);
if (attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
@@ -535,21 +552,9 @@ bool CFileInfo::Find(CFSTR path)
return true;
}
}
else if (NName::IsDrivePath(path + rootSize) && path[rootSize + 3] == 0)
{
DWORD attrib = GetFileAttrib(path);
if (attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
ClearBase();
Attrib = attrib;
Name = path + rootSize;
Name.DeleteFrom(2); // we don't need backslash (C:)
return true;
}
}
else
{
unsigned prefixSize = GetNetworkServerPrefixSize(path);
const unsigned prefixSize = GetNetworkServerPrefixSize(path);
if (prefixSize > 0 && path[prefixSize] != 0)
{
if (NName::FindSepar(path + prefixSize) < 0)
@@ -563,7 +568,7 @@ bool CFileInfo::Find(CFSTR path)
{
if (Name == FTEXT("."))
{
Name = path + prefixSize;;
Name = path + prefixSize;
return true;
}
isOK = true;
@@ -583,17 +588,17 @@ bool CFileInfo::Find(CFSTR path)
return true;
}
}
::SetLastError(lastError);
// ::SetLastError(lastError);
}
}
}
}
}
#endif
return false;
return finder.FindFirst(path, *this);
}
bool DoesFileExist(CFSTR name)
{
CFileInfo fi;
@@ -706,7 +711,7 @@ bool MyGetLogicalDriveStrings(CObjectVector<FString> &driveStrings)
driveStrings.Add(fas2fs(s));
}
}
return prev == newSize;;
return prev == newSize;
}
else
#endif
+30 -18
View File
@@ -374,54 +374,66 @@ static bool ResolveDotsFolders(UString &s)
#ifdef _WIN32
// s.Replace(L'/', WCHAR_PATH_SEPARATOR);
#endif
for (unsigned i = 0;;)
{
wchar_t c = s[i];
const wchar_t c = s[i];
if (c == 0)
return true;
if (c == '.' && (i == 0 || IS_SEPAR(s[i - 1])))
{
wchar_t c1 = s[i + 1];
const wchar_t c1 = s[i + 1];
if (c1 == '.')
{
wchar_t c2 = s[i + 2];
const wchar_t c2 = s[i + 2];
if (IS_SEPAR(c2) || c2 == 0)
{
if (i == 0)
return false;
int k = i - 2;
for (; k >= 0; k--)
if (IS_SEPAR(s[(unsigned)k]))
i += 2;
for (;; k--)
{
if (k < 0)
return false;
if (!IS_SEPAR(s[(unsigned)k]))
break;
}
do
k--;
while (k >= 0 && !IS_SEPAR(s[(unsigned)k]));
unsigned num;
if (k >= 0)
{
num = i + 2 - k;
num = i - k;
i = k;
}
else
{
num = (c2 == 0 ? (i + 2) : (i + 3));
num = (c2 == 0 ? i : (i + 1));
i = 0;
}
s.Delete(i, num);
continue;
}
}
else
else if (IS_SEPAR(c1) || c1 == 0)
{
if (IS_SEPAR(c1) || c1 == 0)
{
unsigned num = 2;
if (i != 0)
i--;
else if (c1 == 0)
num = 1;
s.Delete(i, num);
continue;
}
unsigned num = 2;
if (i != 0)
i--;
else if (c1 == 0)
num = 1;
s.Delete(i, num);
continue;
}
}
i++;
}
}