4.50 beta

This commit is contained in:
Igor Pavlov
2007-07-24 00:00:00 +00:00
committed by Kornel Lesiński
parent 7038848692
commit 980e181dcc
104 changed files with 1419 additions and 4952 deletions

View File

@@ -4,6 +4,13 @@
#include "Wildcard.h"
bool g_CaseSensitive =
#ifdef _WIN32
false;
#else
true;
#endif
static const wchar_t kAnyCharsChar = L'*';
static const wchar_t kAnyCharChar = L'?';
@@ -29,6 +36,13 @@ static inline bool IsCharDirLimiter(wchar_t c)
c == kDirDelimiter2);
}
int CompareFileNames(const UString &s1, const UString &s2)
{
if (g_CaseSensitive)
return s1.Compare(s2);
return s1.CompareNoCase(s2);
}
// -----------------------------------------
// this function tests is name matches mask
// ? - any wchar_t or empty
@@ -67,10 +81,12 @@ static bool EnhancedMaskTest(const UString &mask, int maskPos,
{
wchar_t c = name[namePos];
if (maskChar != c)
#ifdef _WIN32
if (MyCharUpper(maskChar) != MyCharUpper(c))
#endif
{
if (g_CaseSensitive)
return false;
else if (MyCharUpper(maskChar) != MyCharUpper(c))
return false;
}
return EnhancedMaskTest(mask, maskPos + 1, name, namePos + 1);
}
}
@@ -200,7 +216,7 @@ bool CItem::CheckPath(const UStringVector &pathParts, bool isFile) const
int CCensorNode::FindSubNode(const UString &name) const
{
for (int i = 0; i < SubNodes.Size(); i++)
if (SubNodes[i].Name.CompareNoCase(name) == 0)
if (CompareFileNames(SubNodes[i].Name, name) == 0)
return i;
return -1;
}
@@ -360,7 +376,7 @@ void CCensorNode::ExtendExclude(const CCensorNode &fromNodes)
int CCensor::FindPrefix(const UString &prefix) const
{
for (int i = 0; i < Pairs.Size(); i++)
if (Pairs[i].Prefix.CompareNoCase(prefix) == 0)
if (CompareFileNames(Pairs[i].Prefix, prefix) == 0)
return i;
return -1;
}

View File

@@ -5,6 +5,8 @@
#include "MyString.h"
int CompareFileNames(const UString &s1, const UString &s2);
void SplitPathToParts(const UString &path, UStringVector &pathParts);
void SplitPathToParts(const UString &path, UString &dirPrefix, UString &name);
UString ExtractDirPrefixFromPath(const UString &path);