From fd32cd95e7519cd9846fd5cbfe3e3bee84d5000e Mon Sep 17 00:00:00 2001 From: asava Date: Sun, 10 May 2020 10:59:33 +0300 Subject: [PATCH] Shorten displayed name when volume label missing --- rEFIt_UEFI/entry_scan/loader.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index 92d0f3d13..88efd36dd 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -701,16 +701,17 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath, BOOLEAN BootCampStyle = ThemeX.BootCampStyle; if ( Entry->Title.isEmpty() && ((Entry->VolName == NULL) || (StrLen(Entry->VolName) == 0)) ) { + XStringW BasenameXW = XStringW(Basename(Volume->DevicePathString)); // DBG("encounter Entry->VolName ==%ls and StrLen(Entry->VolName) ==%llu\n",Entry->VolName, StrLen(Entry->VolName)); if (BootCampStyle) { if (!LoaderTitle.isEmpty()) { Entry->Title = LoaderTitle; } else { - Entry->Title.takeValueFrom(Basename(Volume->DevicePathString)); + Entry->Title = (BasenameXW.contains(L"-")) ? BasenameXW.subString(0,BasenameXW.indexOf(L"-") + 1) + L"..)" : BasenameXW; } } else { Entry->Title.SWPrintf("Boot %ls from %ls", (!LoaderTitle.isEmpty()) ? LoaderTitle.wc_str() : LoaderPath.basename().wc_str(), - Basename(Volume->DevicePathString)); + (BasenameXW.contains(L"-")) ? (BasenameXW.subString(0,BasenameXW.indexOf(L"-") + 1) + L"..)").wc_str() : BasenameXW.wc_str()); } } // DBG("check Entry->Title \n");