diff --git a/Build/Notepad3.ini b/Build/Notepad3.ini index 7caa767dc..3637658f1 100644 Binary files a/Build/Notepad3.ini and b/Build/Notepad3.ini differ diff --git a/src/Dialogs.c b/src/Dialogs.c index cae51b3ba..2473242f4 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -2731,18 +2731,21 @@ void DialogFileBrowse(HWND hwnd) // DialogUpdateCheck() // // +extern WCHAR g_tchUpdateCheckerExe[]; + void DialogUpdateCheck(HWND hwnd, bool bExecInstaller) { - WCHAR tchExeFile[MAX_PATH+2]; - WCHAR tchTemp[MAX_PATH+2]; + WCHAR tchExe[MAX_PATH+2]; - if (!IniGetString(L"Settings2", L"UpdateChecker.exe", L"", tchTemp, COUNTOF(tchTemp))) - { - if (!SearchPath(NULL, L"wyUpdate.exe", NULL, COUNTOF(tchExeFile), tchExeFile, NULL)) { - GetModuleFileName(NULL, tchExeFile, COUNTOF(tchExeFile)); - PathRemoveFileSpec(tchExeFile); - PathCchAppend(tchExeFile, COUNTOF(tchExeFile), L"wyUpdate.exe"); - } + StringCchCopyW(tchExe, COUNTOF(tchExe), g_tchUpdateCheckerExe); + if (!StringCchLenW(tchExe, COUNTOF(tchExe))) { return; } + + WCHAR tchExePath[MAX_PATH + 2]; + if (!SearchPath(NULL, tchExe, L".exe", COUNTOF(tchExePath), tchExePath, NULL)) { + // try Notepad3's dir path + GetModuleFileName(NULL, tchExePath, COUNTOF(tchExePath)); + PathRemoveFileSpec(tchExePath); + PathCchAppend(tchExePath, COUNTOF(tchExePath), tchExe); } SHELLEXECUTEINFO sei; @@ -2751,7 +2754,7 @@ void DialogUpdateCheck(HWND hwnd, bool bExecInstaller) sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOZONECHECKS; sei.hwnd = hwnd; sei.lpVerb = NULL; - sei.lpFile = tchExeFile; + sei.lpFile = tchExePath; sei.lpParameters = NULL; // tchParam; sei.lpDirectory = g_wchWorkingDirectory; sei.nShow = SW_SHOWNORMAL; diff --git a/src/Notepad3.c b/src/Notepad3.c index ead1d2382..6675f3e2c 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -132,6 +132,7 @@ WCHAR g_tchFileDlgFilters[XXXL_BUFFER] = { L'\0' }; WCHAR g_tchLastSaveCopyDir[MAX_PATH] = { L'\0' }; WCHAR g_tchOpenWithDir[MAX_PATH] = { L'\0' }; WCHAR g_tchFavoritesDir[MAX_PATH] = { L'\0' }; +WCHAR g_tchUpdateCheckerExe[MAX_PATH] = { L'\0' }; static WCHAR g_tchDefaultExtension[64] = { L'\0' }; static WCHAR g_tchDefaultDir[MAX_PATH] = { L'\0' }; @@ -2769,6 +2770,9 @@ void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam) } EnableCmd(hmenu, CMD_OPEN_HYPERLINK, bIsHLink); + i = StringCchLenW(g_tchUpdateCheckerExe, COUNTOF(g_tchUpdateCheckerExe)); + EnableCmd(hmenu, IDM_HELP_UPDATEINSTALLER, i); + UNUSED(lParam); } @@ -6437,12 +6441,10 @@ void LoadSettings() bStickyWinPos = IniSectionGetInt(pIniSection,L"StickyWindowPosition",0); if (bStickyWinPos) bStickyWinPos = 1; - IniSectionGetString(pIniSection,L"DefaultExtension",L"txt", - g_tchDefaultExtension,COUNTOF(g_tchDefaultExtension)); + IniSectionGetString(pIniSection,L"DefaultExtension",L"txt", g_tchDefaultExtension,COUNTOF(g_tchDefaultExtension)); StrTrim(g_tchDefaultExtension,L" \t.\""); - IniSectionGetString(pIniSection,L"DefaultDirectory",L"", - g_tchDefaultDir,COUNTOF(g_tchDefaultDir)); + IniSectionGetString(pIniSection,L"DefaultDirectory",L"", g_tchDefaultDir,COUNTOF(g_tchDefaultDir)); ZeroMemory(g_tchFileDlgFilters,sizeof(WCHAR)*COUNTOF(g_tchFileDlgFilters)); IniSectionGetString(pIniSection,L"FileDlgFilters",L"", @@ -6475,6 +6477,8 @@ void LoadSettings() iCurrentLineVerticalSlop = IniSectionGetInt(pIniSection, L"CurrentLineVerticalSlop", 5); iCurrentLineVerticalSlop = max(min(iCurrentLineVerticalSlop, 200), 0); + IniSectionGetString(pIniSection, L"UpdateChecker.exe", L"", g_tchUpdateCheckerExe, COUNTOF(g_tchUpdateCheckerExe)); + // -------------------------------------------------------------------------- LoadIniSection(L"Statusbar Settings", pIniSection, cchIniSection); // --------------------------------------------------------------------------