Commit 5b01ea11 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

beautify regexes

parent c38cb83d
......@@ -36,12 +36,14 @@
namespace Core {
namespace Utils {
#define WINDOWS_DEVICES "CON|AUX|PRN|COM1|COM2|LPT1|LPT2|NUL"
// Naming a file like a device name will break on Windows, even if it is
// "com1.txt". Since we are cross-platform, we generally disallow such file
// names.
static const QRegExp &windowsDeviceNoSubDirPattern()
{
static const QRegExp rc(QLatin1String("CON|AUX|PRN|COM1|COM2|LPT1|LPT2|NUL"),
static const QRegExp rc(QLatin1String(WINDOWS_DEVICES),
Qt::CaseInsensitive);
QTC_ASSERT(rc.isValid(), return rc);
return rc;
......@@ -49,8 +51,7 @@ static const QRegExp &windowsDeviceNoSubDirPattern()
static const QRegExp &windowsDeviceSubDirPattern()
{
static const QRegExp rc(QLatin1String(".*[/\\\\]CON|.*[/\\\\]AUX|.*[/\\\\]PRN|.*[/\\\\]COM1|.*[/\\\\]COM2|.*[/\\\\]LPT1|.*[/\\\\]LPT2|.*[/\\\\]NUL"),
Qt::CaseInsensitive);
static const QRegExp rc(QLatin1String(".*[/\\\\](" WINDOWS_DEVICES ")"), Qt::CaseInsensitive);
QTC_ASSERT(rc.isValid(), return rc);
return rc;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment