mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Portable installer: Do not ask the user for confirmation when upgrading an existing installation during an automated install
This commit is contained in:
parent
c911dfc40e
commit
80b0842aea
@ -500,7 +500,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
|||||||
int ret = 0, argc;
|
int ret = 0, argc;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
LPWSTR tgt = NULL, dest = NULL, *argv, unpack_dir = NULL;
|
LPWSTR tgt = NULL, dest = NULL, *argv, unpack_dir = NULL;
|
||||||
BOOL existing = false, launch = false;
|
BOOL existing = false, launch = false, automated = false;
|
||||||
WCHAR buf[4*MAX_PATH] = {0}, mb_msg[4*MAX_PATH] = {0}, fdest[4*MAX_PATH] = {0};
|
WCHAR buf[4*MAX_PATH] = {0}, mb_msg[4*MAX_PATH] = {0}, fdest[4*MAX_PATH] = {0};
|
||||||
|
|
||||||
if (!load_data(&cdata, &csz)) return 0;
|
if (!load_data(&cdata, &csz)) return 0;
|
||||||
@ -513,6 +513,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
|||||||
if (argv == NULL) { show_last_error(L"Failed to get command line"); return 0; }
|
if (argv == NULL) { show_last_error(L"Failed to get command line"); return 0; }
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
tgt = argv[1];
|
tgt = argv[1];
|
||||||
|
automated = true;
|
||||||
} else {
|
} else {
|
||||||
tgt = get_directory_from_user();
|
tgt = get_directory_from_user();
|
||||||
if (tgt == NULL) goto end;
|
if (tgt == NULL) goto end;
|
||||||
@ -545,7 +546,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
|||||||
} while (wcslen(fdest) > 58);
|
} while (wcslen(fdest) > 58);
|
||||||
|
|
||||||
// Confirm the user wants to upgrade
|
// Confirm the user wants to upgrade
|
||||||
if (existing) {
|
if (existing && !automated) {
|
||||||
_snwprintf_s(mb_msg, 4*MAX_PATH, _TRUNCATE,
|
_snwprintf_s(mb_msg, 4*MAX_PATH, _TRUNCATE,
|
||||||
L"An existing install of Calibre Portable was found at %s. Do you want to upgrade it?",
|
L"An existing install of Calibre Portable was found at %s. Do you want to upgrade it?",
|
||||||
fdest);
|
fdest);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user