mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-03 07:55:52 +00:00
Fix possible false positive
This commit is contained in:
parent
b13c90c331
commit
676a82a8dd
@ -15,14 +15,18 @@ void SanitizePath(std::string& path)
|
|||||||
bool ic = false;
|
bool ic = false;
|
||||||
std::transform(path.begin(), path.end(), path.begin(), [&](const char a) -> char {
|
std::transform(path.begin(), path.end(), path.begin(), [&](const char a) -> char {
|
||||||
++p1;
|
++p1;
|
||||||
|
static const std::string illegals {"<>?*\"|"};
|
||||||
|
if (illegals.find_first_of(a) != std::string::npos)
|
||||||
|
{
|
||||||
|
ic = false;
|
||||||
|
return '_';
|
||||||
|
}
|
||||||
|
|
||||||
if (ic)
|
if (ic)
|
||||||
{
|
{
|
||||||
ic = false;
|
ic = false;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
static const std::string illegals {"<>?*\"|"};
|
|
||||||
if (illegals.find_first_of(a) != std::string::npos)
|
|
||||||
return '_';
|
|
||||||
if (a == '\\' && (p1 == path.end() || *p1 != '\\'))
|
if (a == '\\' && (p1 == path.end() || *p1 != '\\'))
|
||||||
{
|
{
|
||||||
ic = true;
|
ic = true;
|
||||||
@ -42,14 +46,18 @@ void SanitizePath(std::wstring& path)
|
|||||||
bool ic = false;
|
bool ic = false;
|
||||||
std::transform(path.begin(), path.end(), path.begin(), [&](const wchar_t a) -> wchar_t {
|
std::transform(path.begin(), path.end(), path.begin(), [&](const wchar_t a) -> wchar_t {
|
||||||
++p1;
|
++p1;
|
||||||
|
static const std::wstring illegals {L"<>?*\"|"};
|
||||||
|
if (illegals.find_first_of(a) != std::wstring::npos)
|
||||||
|
{
|
||||||
|
ic = false;
|
||||||
|
return L'_';
|
||||||
|
}
|
||||||
|
|
||||||
if (ic)
|
if (ic)
|
||||||
{
|
{
|
||||||
ic = false;
|
ic = false;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
static const std::wstring illegals {L"<>?*\"|"};
|
|
||||||
if (illegals.find_first_of(a) != std::wstring::npos)
|
|
||||||
return L'_';
|
|
||||||
if (a == L'\\' && (p1 == path.end() || *p1 != L'\\'))
|
if (a == L'\\' && (p1 == path.end() || *p1 != L'\\'))
|
||||||
{
|
{
|
||||||
ic = true;
|
ic = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user