mirror of
https://github.com/tnodir/fort
synced 2024-11-15 11:45:09 +00:00
UI: FileUtil: Improve pathToKernelPath()
This commit is contained in:
parent
5bcb649a67
commit
67c23bb5e2
@ -73,22 +73,24 @@ QString kernelPathToPath(const QString &kernelPath)
|
|||||||
QString pathToKernelPath(const QString &path, bool lower)
|
QString pathToKernelPath(const QString &path, bool lower)
|
||||||
{
|
{
|
||||||
QString kernelPath = path;
|
QString kernelPath = path;
|
||||||
|
|
||||||
if (path.size() > 1) {
|
if (path.size() > 1) {
|
||||||
const auto char1 = path.at(0);
|
const QChar char1 = path.at(0);
|
||||||
if (char1.isLetter()) {
|
if (char1.isLetter()) {
|
||||||
if (path.at(1) == ':') {
|
if (path.at(1) == ':') {
|
||||||
const QString drive = path.left(2);
|
const QString drive = path.left(2);
|
||||||
kernelPath = driveToKernelName(drive)
|
kernelPath = driveToKernelName(drive) + path.mid(2);
|
||||||
+ path.mid(2).replace(QLatin1Char('/'), QLatin1Char('\\'));
|
} else if (isSystemApp(path)) {
|
||||||
} else {
|
return systemApp();
|
||||||
if (isSystemApp(path))
|
|
||||||
return systemApp();
|
|
||||||
}
|
}
|
||||||
} else if ((char1 == '?' || char1 == '*') && path.at(1) == ':') {
|
} else if ((char1 == '?' || char1 == '*') && path.at(1) == ':') {
|
||||||
// Replace "?:\\" with "\\Device\\*\\"
|
// Replace "?:\\" with "\\Device\\*\\"
|
||||||
kernelPath = "\\Device\\*" + path.mid(2);
|
kernelPath = "\\Device\\*" + path.mid(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kernelPath = kernelPath.replace(QLatin1Char('/'), QLatin1Char('\\'));
|
||||||
|
|
||||||
return lower ? kernelPath.toLower() : kernelPath;
|
return lower ? kernelPath.toLower() : kernelPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user