@@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2727#include < Vsstyle.h>
2828#include < Vssym32.h>
2929
30+ #include < format>
31+
3032#include " Explorer.h"
3133#include " ExplorerDialog.h"
3234#include " ExplorerResource.h"
@@ -352,9 +354,9 @@ INT_PTR CALLBACK FavesDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP
352354 }
353355
354356 // make tooltip text.
355- tipText += StringUtil ::format (L" \n This session has %d files" , count);
357+ tipText += std ::format (L" \n This session has {} files" , count);
356358 if (nonExistentFileCount > 0 ) {
357- tipText += StringUtil ::format (L" (%d are non-existent)" , nonExistentFileCount);
359+ tipText += std ::format (L" ({} are non-existent)" , nonExistentFileCount);
358360 }
359361 tipText += L" ." ;
360362 }
@@ -648,7 +650,7 @@ void FavesDialog::PasteItem(HTREEITEM hItem)
648650 }
649651 else {
650652 WCHAR msgBoxTxt[128 ];
651- _stprintf (msgBoxTxt, L" Could only be paste into %s " , source->Root ()->Name ().c_str ());
653+ _stprintf (msgBoxTxt, L" Could only be paste into %ls " , source->Root ()->Name ().c_str ());
652654 ::MessageBox (_hParent, msgBoxTxt, L" Error" , MB_OK);
653655 }
654656}
@@ -1018,12 +1020,10 @@ void FavesDialog::OpenContext(HTREEITEM hItem, POINT pt)
10181020 case FM_NEWGROUP: {
10191021 LPTSTR pszName = (LPTSTR)new WCHAR[MAX_PATH];
10201022 LPTSTR pszDesc = (LPTSTR)new WCHAR[MAX_PATH];
1021- LPTSTR pszComm = (LPTSTR)new WCHAR[MAX_PATH];
10221023
10231024 pszName[0 ] = ' \0 ' ;
10241025
1025- wcscpy (pszComm, L" New group in %s" );
1026- _stprintf (pszDesc, pszComm, pElem->Root ()->Name ().c_str ());
1026+ _stprintf (pszDesc, L" New group in %ls" , pElem->Root ()->Name ().c_str ());
10271027
10281028 /* init new dialog */
10291029 NewDlg dlgNew;
@@ -1044,7 +1044,6 @@ void FavesDialog::OpenContext(HTREEITEM hItem, POINT pt)
10441044
10451045 delete [] pszName;
10461046 delete [] pszDesc;
1047- delete [] pszComm;
10481047 break ;
10491048 }
10501049 case FM_COPY:
@@ -1358,7 +1357,10 @@ void FavesDialog::OpenLink(FavesItemPtr pElem)
13581357 }
13591358 }
13601359 if (0 < nonExistentFileCount) {
1361- if (IDCANCEL == ::MessageBox (_hSelf, StringUtil::format (L" This session has %d non-existent files. Processing will delete all non-existent files in the session. Are you sure you want to continue?" , nonExistentFileCount).c_str (), L" Open Session" , MB_OKCANCEL | MB_ICONWARNING)) {
1360+ const std::wstring msg = std::format (L" This session has {} non-existent files. "
1361+ L" Processing will delete all non-existent files in the session. Are you sure you want to continue?" ,
1362+ nonExistentFileCount);
1363+ if (IDCANCEL == ::MessageBox (_hSelf, msg.c_str (), L" Open Session" , MB_OKCANCEL | MB_ICONWARNING)) {
13621364 return ;
13631365 }
13641366 }
@@ -1566,7 +1568,7 @@ void FavesDialog::SaveSettings()
15661568 ::WriteFile (hFile, szBOM, sizeof (szBOM), &hasWritten, nullptr);
15671569
15681570 for (auto *root : { _model.FolderRoot (), _model.FileRoot (), _model.WebRoot (), _model.SessionRoot () }) {
1569- std::wstring temp = StringUtil ::format (L" %s \n Expand=%i \n\n " , root->Name ().c_str (), root->IsExpanded ());
1571+ std::wstring temp = std ::format (L" {} \n Expand={} \n\n " , root->Name ().c_str (), root->IsExpanded ());
15701572 ::WriteFile (hFile, temp.c_str(), (DWORD)temp.length() * sizeof(WCHAR), &hasWritten, nullptr);
15711573 SaveElementTreeRecursive (root, hFile);
15721574 }
@@ -1590,10 +1592,10 @@ void FavesDialog::SaveElementTreeRecursive(FavesItemPtr pElem, HANDLE hFile)
15901592 if (child->IsGroup ()) {
15911593 ::WriteFile (hFile, L" #GROUP\n " , (DWORD)wcslen(L" #GROUP\n " ) * sizeof(WCHAR), &hasWritten, nullptr);
15921594
1593- std::wstring temp = StringUtil ::format (L" \t Name=%s \n " , child->Name ().c_str ());
1595+ std::wstring temp = std ::format (L" \t Name={} \n " , child->Name ().c_str ());
15941596 ::WriteFile (hFile, temp.c_str(), (DWORD)temp.length() * sizeof(WCHAR), &hasWritten, nullptr);
15951597
1596- temp = StringUtil ::format (L" \t Expand=%i \n\n " , child->IsExpanded ());
1598+ temp = std ::format (L" \t Expand={} \n\n " , child->IsExpanded ());
15971599 ::WriteFile (hFile, temp.c_str(), (DWORD)temp.length() * sizeof(WCHAR), &hasWritten, nullptr);
15981600
15991601 SaveElementTreeRecursive (child.get (), hFile);
@@ -1603,10 +1605,10 @@ void FavesDialog::SaveElementTreeRecursive(FavesItemPtr pElem, HANDLE hFile)
16031605 else if (child->IsLink ()) {
16041606 ::WriteFile (hFile, L" #LINK\n " , (DWORD)wcslen(L" #LINK\n " ) * sizeof(WCHAR), &hasWritten, nullptr);
16051607
1606- std::wstring temp = StringUtil ::format (L" \t Name=%s \n " , child->Name ().c_str ());
1608+ std::wstring temp = std ::format (L" \t Name={} \n " , child->Name ().c_str ());
16071609 ::WriteFile (hFile, temp.c_str(), (DWORD)temp.length() * sizeof(WCHAR), &hasWritten, nullptr);
16081610
1609- temp = StringUtil ::format (L" \t Link=%s \n\n " , child->Link ().c_str ());
1611+ temp = std ::format (L" \t Link={} \n\n " , child->Link ().c_str ());
16101612 ::WriteFile (hFile, temp.c_str(), (DWORD)temp.length() * sizeof(WCHAR), &hasWritten, nullptr);
16111613 }
16121614 }
0 commit comments