mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-20 21:13:25 +08:00
+fix: Add to Favorites: keep base-filename + extension
This commit is contained in:
parent
5b8163478c
commit
229eced1ae
@ -2123,6 +2123,7 @@ bool AddToFavDlg(HWND hwnd, const HPATHL hTargetPth)
|
||||
AddToFavDlgProc, (LPARAM)szDisplayName);
|
||||
|
||||
if (iResult == IDOK) {
|
||||
StringCchCat(szDisplayName, COUNTOF(szDisplayName), L".lnk");
|
||||
if (!Path_CreateFavLnk(szDisplayName, hTargetPth, Settings.FavoritesDir)) {
|
||||
InfoBoxLng(MB_ICONWARNING,NULL,IDS_MUI_FAV_FAILURE);
|
||||
return false;
|
||||
|
||||
@ -739,8 +739,8 @@ bool PTHAPI Path_Append(HPATHL hpth_in_out, LPCWSTR more)
|
||||
return true;
|
||||
}
|
||||
|
||||
LPWSTR const wbuf = StrgWriteAccessBuf(hstr_io, hstr_len + hmore_len + wcslen(PATHLONG_PREFIX) + 2);
|
||||
size_t const cch = StrgGetAllocLength(hstr_io);
|
||||
LPWSTR const wbuf = StrgWriteAccessBuf(hstr_io, hstr_len + hmore_len + wcslen(PATHLONG_PREFIX) + 2);
|
||||
size_t const cch = StrgGetAllocLength(hstr_io);
|
||||
|
||||
// append directory separator
|
||||
if (hstr_len > 0) {
|
||||
@ -1524,16 +1524,16 @@ bool PTHAPI Path_IsLnkToDirectory(const HPATHL hlnk_pth, HPATHL hpth_out)
|
||||
// Path_CreateFavLnk()
|
||||
// Create a Notepad3 favorites link
|
||||
//
|
||||
bool PTHAPI Path_CreateFavLnk(LPCWSTR lpszDisplayName, const HPATHL hTargetPth, const HPATHL hDirPth)
|
||||
bool PTHAPI Path_CreateFavLnk(LPCWSTR lpszLinkName, const HPATHL hTargetPth, const HPATHL hDirPth)
|
||||
{
|
||||
if (StrIsEmptyW(lpszDisplayName)) {
|
||||
if (StrIsEmptyW(lpszLinkName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bSucceeded = false;
|
||||
|
||||
HPATHL hlnk_pth = Path_Copy(hDirPth);
|
||||
Path_Append(hlnk_pth, lpszDisplayName);
|
||||
Path_Append(hlnk_pth, lpszLinkName);
|
||||
Path_RenameExtension(hlnk_pth, L".lnk");
|
||||
|
||||
if (!Path_IsExistingFile(hlnk_pth)) {
|
||||
|
||||
@ -124,7 +124,7 @@ void PTHAPI Path_GetDisplayName(LPWSTR lpszDisplayName, const DWORD c
|
||||
bool PTHAPI Path_GetLnkPath(const HPATHL hLnkFilePth, HPATHL hResPath_out);
|
||||
bool PTHAPI Path_IsLnkFile(const HPATHL hpth);
|
||||
bool PTHAPI Path_IsLnkToDirectory(const HPATHL hlnk_pth, HPATHL hpth_out);
|
||||
bool PTHAPI Path_CreateFavLnk(LPCWSTR lpszDisplayName, const HPATHL hTargetPth, const HPATHL hDirPth);
|
||||
bool PTHAPI Path_CreateFavLnk(LPCWSTR lpszLinkName, const HPATHL hTargetPth, const HPATHL hDirPth);
|
||||
bool PTHAPI Path_CreateDeskLnk(const HPATHL hDocumentPath, LPCWSTR pszDescription);
|
||||
bool PTHAPI Path_BrowseDirectory(HWND hwndParent, LPCWSTR lpszTitle, HPATHL hpth_in_out, const HPATHL hbase, bool bNewDialogStyle);
|
||||
bool PTHAPI Path_CanonicalizeEx(HPATHL hpth_in_out);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user