metaforce/hecl/lib/HECL.cpp

33 lines
1005 B
C++
Raw Normal View History

#include "HECL/HECL.hpp"
namespace HECL
{
2015-08-06 19:10:12 +00:00
unsigned VerbosityLevel = 0;
LogVisor::LogModule LogModule("HECL");
2015-08-05 01:54:35 +00:00
void SanitizePath(std::string& path)
{
path.erase(std::remove(path.begin(), path.end(), '\n'), path.end());
path.erase(std::remove(path.begin(), path.end(), '\r'), path.end());
2015-08-05 02:40:54 +00:00
std::transform(path.begin(), path.end(), path.begin(), [](const char a) -> char {
static const std::string illegals {"<>?*\"|"};
if (illegals.find_first_of(a) != std::string::npos)
return '_';
return a;
});
2015-08-05 01:54:35 +00:00
}
void SanitizePath(std::wstring& path)
{
path.erase(std::remove(path.begin(), path.end(), L'\n'), path.end());
path.erase(std::remove(path.begin(), path.end(), L'\r'), path.end());
2015-08-05 02:40:54 +00:00
std::transform(path.begin(), path.end(), path.begin(), [](const wchar_t a) -> wchar_t {
static const std::wstring illegals {L"<>?*\"|"};
if (illegals.find_first_of(a) != std::wstring::npos)
return L'_';
return a;
});
2015-08-05 01:54:35 +00:00
}
}