+ rm: disabling UpdateChecker menu entry if no executable is configured

This commit is contained in:
Rainer Kottenhoff 2018-04-28 16:13:55 +02:00
parent f4cf622d5a
commit d0149be2d6
3 changed files with 21 additions and 14 deletions

Binary file not shown.

View File

@ -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;

View File

@ -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);
// --------------------------------------------------------------------------