mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:25:20 +00:00
UI: FileUtil: Improve pathToKernelPath()
This commit is contained in:
parent
5bcb649a67
commit
67c23bb5e2
@ -73,15 +73,14 @@ QString kernelPathToPath(const QString &kernelPath)
|
||||
QString pathToKernelPath(const QString &path, bool lower)
|
||||
{
|
||||
QString kernelPath = path;
|
||||
|
||||
if (path.size() > 1) {
|
||||
const auto char1 = path.at(0);
|
||||
const QChar 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 (isSystemApp(path))
|
||||
kernelPath = driveToKernelName(drive) + path.mid(2);
|
||||
} else if (isSystemApp(path)) {
|
||||
return systemApp();
|
||||
}
|
||||
} else if ((char1 == '?' || char1 == '*') && path.at(1) == ':') {
|
||||
@ -89,6 +88,9 @@ QString pathToKernelPath(const QString &path, bool lower)
|
||||
kernelPath = "\\Device\\*" + path.mid(2);
|
||||
}
|
||||
}
|
||||
|
||||
kernelPath = kernelPath.replace(QLatin1Char('/'), QLatin1Char('\\'));
|
||||
|
||||
return lower ? kernelPath.toLower() : kernelPath;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user