mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add proper paths in windows frozen build
This commit is contained in:
parent
8c7c3c9061
commit
488fe5198b
@ -190,8 +190,10 @@ run_interpreter() {
|
|||||||
|
|
||||||
status = PyConfig_SetString(&config, &config.program_name, interpreter_data.exe_path);
|
status = PyConfig_SetString(&config, &config.program_name, interpreter_data.exe_path);
|
||||||
CHECK_STATUS;
|
CHECK_STATUS;
|
||||||
|
#ifndef _WIN32
|
||||||
status = PyConfig_SetString(&config, &config.home, interpreter_data.python_home_path);
|
status = PyConfig_SetString(&config, &config.home, interpreter_data.python_home_path);
|
||||||
CHECK_STATUS;
|
CHECK_STATUS;
|
||||||
|
#endif
|
||||||
status = PyConfig_SetString(&config, &config.run_module, L"site");
|
status = PyConfig_SetString(&config, &config.run_module, L"site");
|
||||||
CHECK_STATUS;
|
CHECK_STATUS;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -82,3 +82,7 @@ def main():
|
|||||||
set_quit()
|
set_quit()
|
||||||
|
|
||||||
return run_entry_point()
|
return run_entry_point()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
@ -72,7 +72,6 @@ int show_last_error(wchar_t *preamble) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static wchar_t qt_prefix_dir[MAX_PATH] = {0};
|
static wchar_t qt_prefix_dir[MAX_PATH] = {0};
|
||||||
static wchar_t w_program_name[MAX_PATH] = {0};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_app_dirw(void) {
|
get_app_dirw(void) {
|
||||||
@ -80,11 +79,14 @@ get_app_dirw(void) {
|
|||||||
wchar_t drive[4] = L"\0\0\0";
|
wchar_t drive[4] = L"\0\0\0";
|
||||||
DWORD sz; errno_t err;
|
DWORD sz; errno_t err;
|
||||||
|
|
||||||
sz = GetModuleFileNameW(NULL, w_program_name, MAX_PATH);
|
sz = GetModuleFileNameW(NULL, interpreter_data.exe_path, MAX_PATH);
|
||||||
if (sz >= MAX_PATH-1) ExitProcess(_show_error(L"Installation directory path too long", L"", 1));
|
if (sz >= MAX_PATH-1) ExitProcess(_show_error(L"Installation directory path too long", L"", 1));
|
||||||
err = _wsplitpath_s(w_program_name, drive, 4, buf, MAX_PATH, NULL, 0, NULL, 0);
|
err = _wsplitpath_s(interpreter_data.exe_path, drive, 4, buf, MAX_PATH, NULL, 0, NULL, 0);
|
||||||
if (err != 0) ExitProcess(show_last_error_crt(L"Failed to find application directory"));
|
if (err != 0) ExitProcess(show_last_error_crt(L"Failed to find application directory"));
|
||||||
_snwprintf_s(interpreter_data.app_dir, MAX_PATH, _TRUNCATE, L"%ls%ls", drive, buf);
|
_snwprintf_s(interpreter_data.app_dir, MAX_PATH, _TRUNCATE, L"%ls%ls", drive, buf);
|
||||||
|
_snwprintf_s(interpreter_data.resources_path, MAX_PATH, _TRUNCATE, L"%ls%lsapp\\resources", drive, buf);
|
||||||
|
_snwprintf_s(interpreter_data.extensions_path, MAX_PATH, _TRUNCATE, L"%ls%lsapp\\bin", drive, buf);
|
||||||
|
_snwprintf_s(interpreter_data.executables_path, MAX_PATH, _TRUNCATE, L"%ls%lsapp\\bin", drive, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user