UI: Fix unrecognized kernel paths handling

This commit is contained in:
Nodir Temirkhodjaev 2023-12-29 16:09:51 +03:00
parent 7acd81cd02
commit 206392988c
2 changed files with 12 additions and 1 deletions

View File

@ -39,6 +39,13 @@ TEST_F(FileUtilTest, paths)
ASSERT_EQ(FileUtil::pathToKernelPath(path, /*lower=*/false), kernelPath);
}
TEST_F(FileUtilTest, mupPath)
{
const QString path(R"(\device\mup\vmware-host\shared folders\d\test.exe)");
ASSERT_EQ(FileUtil::kernelPathToPath(path), path);
}
TEST_F(FileUtilTest, systemPath)
{
ASSERT_EQ(FileUtil::pathToKernelPath("System", /*lower=*/true), FileUtil::systemApp());

View File

@ -105,7 +105,11 @@ QString kernelPathToPath(const QString &kernelPath)
const int sepPos2 = kernelPath.indexOf(sep, sepPos1 + 1);
if (sepPos2 > 0) {
const QString kernelName = kernelPath.left(sepPos2);
return kernelNameToDrive(kernelName) + kernelPath.mid(sepPos2);
const QString driveName = kernelNameToDrive(kernelName);
if (!driveName.isEmpty()) {
return driveName + kernelPath.mid(sepPos2);
}
}
}
}