diff --git a/src/tests/confutil/test.cpp b/src/tests/confutil/test.cpp index 109ab62a..37b793cd 100644 --- a/src/tests/confutil/test.cpp +++ b/src/tests/confutil/test.cpp @@ -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")))); diff --git a/src/ui/util/fileutil.cpp b/src/ui/util/fileutil.cpp index 19875801..a7fe45f7 100644 --- a/src/ui/util/fileutil.cpp +++ b/src/ui/util/fileutil.cpp @@ -67,14 +67,21 @@ 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(':')) { - const QString drive = path.left(2); - kernelPath = driveToKernelName(drive) - + path.mid(2).replace(QLatin1Char('/'), QLatin1Char('\\')); - } else { - if (QString::compare(path, systemPath, Qt::CaseInsensitive) == 0) - return systemPath; + 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('\\')); + } else { + 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;