icons: fix quoting issues

This commit is contained in:
2 * r + 2 * t 2025-07-21 22:15:20 +10:00
parent ba45106e7e
commit 9743a2e9b8

View file

@ -237,11 +237,11 @@ Singleton {
path: "/etc/os-release"
onLoaded: {
const lines = text().split("\n");
let osId = lines.find(l => l.startsWith("ID="))?.split("=")[1];
let osId = lines.find(l => l.startsWith("ID="))?.split("=")[1].replace(/"/g, "");
if (root.osIcons.hasOwnProperty(osId))
root.osIcon = root.osIcons[osId];
else {
const osIdLike = lines.find(l => l.startsWith("ID_LIKE="))?.split("=")[1];
const osIdLike = lines.find(l => l.startsWith("ID_LIKE="))?.split("=")[1].replace(/"/g, "");
if (osIdLike)
for (const id of osIdLike.split(" "))
if (root.osIcons.hasOwnProperty(id))
@ -251,7 +251,7 @@ Singleton {
let nameLine = lines.find(l => l.startsWith("PRETTY_NAME="));
if (!nameLine)
nameLine = lines.find(l => l.startsWith("NAME="));
root.osName = nameLine.split("=")[1].slice(1, -1);
root.osName = nameLine.split("=")[1].replace(/"/g, "");
}
}
}