forked from qt-creator/qt-creator
beautify regexes
This commit is contained in:
@@ -36,12 +36,14 @@
|
|||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Utils {
|
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
|
// 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
|
// "com1.txt". Since we are cross-platform, we generally disallow such file
|
||||||
// names.
|
// names.
|
||||||
static const QRegExp &windowsDeviceNoSubDirPattern()
|
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);
|
Qt::CaseInsensitive);
|
||||||
QTC_ASSERT(rc.isValid(), return rc);
|
QTC_ASSERT(rc.isValid(), return rc);
|
||||||
return rc;
|
return rc;
|
||||||
@@ -49,8 +51,7 @@ static const QRegExp &windowsDeviceNoSubDirPattern()
|
|||||||
|
|
||||||
static const QRegExp &windowsDeviceSubDirPattern()
|
static const QRegExp &windowsDeviceSubDirPattern()
|
||||||
{
|
{
|
||||||
static const QRegExp rc(QLatin1String(".*[/\\\\]CON|.*[/\\\\]AUX|.*[/\\\\]PRN|.*[/\\\\]COM1|.*[/\\\\]COM2|.*[/\\\\]LPT1|.*[/\\\\]LPT2|.*[/\\\\]NUL"),
|
static const QRegExp rc(QLatin1String(".*[/\\\\](" WINDOWS_DEVICES ")"), Qt::CaseInsensitive);
|
||||||
Qt::CaseInsensitive);
|
|
||||||
QTC_ASSERT(rc.isValid(), return rc);
|
QTC_ASSERT(rc.isValid(), return rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user