mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Portable Installer: Do not ask to launch calibre when running an automated install. Automated installs will now never launch calibre.
This commit is contained in:
parent
a619ed9ce4
commit
974722696b
@ -504,20 +504,20 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
|||||||
|
|
||||||
LPVOID cdata = NULL;
|
LPVOID cdata = NULL;
|
||||||
DWORD csz = 0;
|
DWORD csz = 0;
|
||||||
int ret = 0, argc;
|
int ret = 1, 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, automated = 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 ret;
|
||||||
|
|
||||||
hr = CoInitialize(NULL);
|
hr = CoInitialize(NULL);
|
||||||
if (FAILED(hr)) { show_error(L"Failed to initialize COM"); return 0; }
|
if (FAILED(hr)) { show_error(L"Failed to initialize COM"); return ret; }
|
||||||
|
|
||||||
// Get the target directory for installation
|
// Get the target directory for installation
|
||||||
argv = CommandLineToArgvW(GetCommandLine(), &argc);
|
argv = CommandLineToArgvW(GetCommandLine(), &argc);
|
||||||
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 ret; }
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
tgt = argv[1];
|
tgt = argv[1];
|
||||||
automated = true;
|
automated = true;
|
||||||
@ -578,17 +578,20 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
|||||||
// Move files from temp dir to the install dir
|
// Move files from temp dir to the install dir
|
||||||
if (!move_program()) goto end;
|
if (!move_program()) goto end;
|
||||||
|
|
||||||
_snwprintf_s(mb_msg, 4*MAX_PATH, _TRUNCATE,
|
ret = 0;
|
||||||
L"Calibre Portable successfully installed to %s. Launch calibre?",
|
if (!automated) {
|
||||||
fdest);
|
_snwprintf_s(mb_msg, 4*MAX_PATH, _TRUNCATE,
|
||||||
launch = MessageBox(NULL, mb_msg,
|
L"Calibre Portable successfully installed to %s. Launch calibre?",
|
||||||
L"Success", MB_ICONINFORMATION | MB_YESNO | MB_TOPMOST) == IDYES;
|
fdest);
|
||||||
|
launch = MessageBox(NULL, mb_msg,
|
||||||
|
L"Success", MB_ICONINFORMATION | MB_YESNO | MB_TOPMOST) == IDYES;
|
||||||
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (unpack_dir != NULL) { SetCurrentDirectoryW(L".."); rmtree(unpack_dir); free(unpack_dir); }
|
if (unpack_dir != NULL) { SetCurrentDirectoryW(L".."); rmtree(unpack_dir); free(unpack_dir); }
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
if (launch) launch_calibre();
|
if (launch) launch_calibre();
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user