Skip to content

Commit f1e2500

Browse files
committed
Add to favourites - append unique suffix #290
1 parent 872eed2 commit f1e2500

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Dialogs.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,20 @@ BOOL AddToFavDlg(HWND hwnd, LPCWSTR lpszName, LPCWSTR lpszTarget)
964964
lstrcpy(params.pszName, lpszName);
965965
lstrcpy(params.pszTarget, lpszTarget);
966966

967+
// [2e]: Add to favourites - append unique suffix #290
968+
WCHAR tchLnkFileName[MAX_PATH] = { 0 };
969+
BOOL bMustCopy = FALSE;
970+
if (SHGetNewLinkInfo(lpszTarget, tchFavoritesDir, tchLnkFileName, &bMustCopy, 0))
971+
{
972+
LPWSTR ptrLnkExtension = PathFindExtension(tchLnkFileName);
973+
if (ptrLnkExtension && (StrCmpI(ptrLnkExtension, L".LNK") == 0))
974+
{
975+
ptrLnkExtension[0] = 0;
976+
}
977+
lstrcpy(params.pszName, PathFindFileName(tchLnkFileName));
978+
}
979+
// [/2e]
980+
967981
iResult = ThemedDialogBoxParam(
968982
g_hInstance,
969983
MAKEINTRESOURCE(IDD_ADDTOFAV),

0 commit comments

Comments
 (0)