@@ -1295,7 +1295,7 @@ VOID ScanLoader(VOID)
1295
1295
continue ;
1296
1296
}
1297
1297
XStringW File = SWPrintf (" EFI\\ %ls\\ grubx64.efi" , DirEntry->FileName );
1298
- XStringW OSName = SPrintf ( " %ls " , DirEntry->FileName ); // this is folder name, for example "ubuntu"
1298
+ XStringW OSName = XStringW (). takeValueFrom ( DirEntry->FileName ); // this is folder name, for example "ubuntu"
1299
1299
OSName.lowerAscii (); // lowercase for icon name and title (first letter in title will be capitalized later)
1300
1300
if (FileExists (Volume->RootDir , File)) {
1301
1301
// check if nonstandard icon mapping is needed
@@ -1309,24 +1309,27 @@ VOID ScanLoader(VOID)
1309
1309
XStringW LoaderTitle = OSName.subString (0 ,1 ); // capitalize first letter for title
1310
1310
LoaderTitle.upperAscii ();
1311
1311
LoaderTitle += OSName.subString (1 , OSName.length ()) + L" Linux" _XSW;
1312
- XImage ImageX; // will the image be destroyed or rewritten by next image after the cycle end?
1313
1312
// Very few linux icons exist in IconNames, but these few may be preloaded, so check that first
1314
- ImageX = ThemeX.GetIcon (L" os_" _XSW + OSName);
1313
+ XImage ImageX = ThemeX.GetIcon (L" os_" _XSW + OSName); // will the image be destroyed or rewritten by next image after the cycle end?
1315
1314
if (ImageX.isEmpty ()) {
1316
1315
// no preloaded icon, try to load from dir
1317
- ImageX.LoadXImage (ThemeX.ThemeDir , ( L" os_" _XSW + OSName). wc_str () );
1316
+ ImageX.LoadXImage (ThemeX.ThemeDir , L" os_" _XSW + OSName);
1318
1317
}
1319
1318
AddLoaderEntry (File, NullXStringArray, LoaderTitle, Volume,
1320
1319
(ImageX.isEmpty () ? NULL : &ImageX), OSTYPE_LINEFI, OSFLAG_NODEFAULTARGS);
1321
1320
} // anyway continue search other entries
1322
1321
}
1323
1322
DirIterClose (&DirIter);
1324
1323
1324
+ // check for non-standard grub path
1325
1325
for (Index = 0 ; Index < LinuxEntryDataCount; ++Index) {
1326
1326
if (FileExists (Volume->RootDir , LinuxEntryData[Index].Path )) {
1327
- XImage ImageX;
1328
- XStringW IconXSW = XStringW ().takeValueFrom (LinuxEntryData[Index].Icon );
1329
- ImageX.LoadXImage (ThemeX.ThemeDir , (L" os_" _XSW + IconXSW.subString (0 , IconXSW.indexOf (' ,' ))).wc_str ());
1327
+ XStringW OSIconName = XStringW ().takeValueFrom (LinuxEntryData[Index].Icon );
1328
+ OSIconName = OSIconName.subString (0 , OSIconName.indexOf (' ,' ));
1329
+ XImage ImageX = ThemeX.GetIcon (L" os_" _XSW + OSIconName);
1330
+ if (ImageX.isEmpty ()) {
1331
+ ImageX.LoadXImage (ThemeX.ThemeDir , L" os_" _XSW + OSIconName);
1332
+ }
1330
1333
AddLoaderEntry (LinuxEntryData[Index].Path , NullXStringArray, XStringW ().takeValueFrom (LinuxEntryData[Index].Title ), Volume,
1331
1334
(ImageX.isEmpty () ? NULL : &ImageX), OSTYPE_LINEFI, OSFLAG_NODEFAULTARGS);
1332
1335
}
0 commit comments