mirror of
https://github.com/tnodir/fort
synced 2024-11-15 09:45:44 +00:00
Fix wild matching the drive letter.
Support only "?:" or "*:", not e.g. "[CD]:".
This commit is contained in:
parent
7b411f3c9d
commit
8bcc95872a
@ -40,7 +40,7 @@ void Test::confWriteRead()
|
||||
);
|
||||
appGroup1->setAllowText(
|
||||
"C:\\Program Files\\Skype\\Phone\\Skype.exe\n"
|
||||
"C:\\Utils\\Dev\\Git\\**\n"
|
||||
"?:\\Utils\\Dev\\Git\\**\n"
|
||||
"D:\\**\\Programs\\**\n"
|
||||
);
|
||||
|
||||
@ -80,7 +80,10 @@ void Test::confWriteRead()
|
||||
data, FileUtil::pathToKernelPath("C:\\Program Files\\Skype\\Phone\\Skype.exe"))));
|
||||
QVERIFY(!FortCommon::confAppBlocked(
|
||||
data, FortCommon::confAppFind(
|
||||
data, FileUtil::pathToKernelPath("C:\\Utils\\Dev\\Git\\**"))));
|
||||
data, FileUtil::pathToKernelPath("C:\\Utils\\Dev\\Git\\git.exe"))));
|
||||
QVERIFY(!FortCommon::confAppBlocked(
|
||||
data, FortCommon::confAppFind(
|
||||
data, FileUtil::pathToKernelPath("D:\\Utils\\Dev\\Git\\bin\\git.exe"))));
|
||||
QVERIFY(!FortCommon::confAppBlocked(
|
||||
data, FortCommon::confAppFind(
|
||||
data, FileUtil::pathToKernelPath("D:\\My\\Programs\\Test.exe"))));
|
||||
|
@ -67,8 +67,10 @@ QString FileUtil::kernelPathToPath(const QString &kernelPath)
|
||||
QString FileUtil::pathToKernelPath(const QString &path, bool lower)
|
||||
{
|
||||
QString kernelPath = path;
|
||||
if (path.size() > 1 && path.at(0).isLetter()) {
|
||||
if (path.at(1) == QLatin1Char(':')) {
|
||||
if (path.size() > 1) {
|
||||
const auto char1 = path.at(0);
|
||||
if (char1.isLetter()) {
|
||||
if (path.at(1) == ':') {
|
||||
const QString drive = path.left(2);
|
||||
kernelPath = driveToKernelName(drive)
|
||||
+ path.mid(2).replace(QLatin1Char('/'), QLatin1Char('\\'));
|
||||
@ -76,6 +78,11 @@ QString FileUtil::pathToKernelPath(const QString &path, bool lower)
|
||||
if (QString::compare(path, systemPath, Qt::CaseInsensitive) == 0)
|
||||
return systemPath;
|
||||
}
|
||||
} else if ((char1 == '?' || char1 == '*')
|
||||
&& path.at(1) == ':') {
|
||||
// Replace "?:\\" with "\\Device\\*\\"
|
||||
kernelPath = "\\Device\\*" + path.mid(2);
|
||||
}
|
||||
}
|
||||
return lower ? kernelPath.toLower() : kernelPath;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user