Add proper paths in windows frozen build

This commit is contained in:
Kovid Goyal 2019-12-03 10:22:41 +05:30
parent 8c7c3c9061
commit 488fe5198b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 11 additions and 3 deletions

View File

@ -190,8 +190,10 @@ run_interpreter() {
status = PyConfig_SetString(&config, &config.program_name, interpreter_data.exe_path);
CHECK_STATUS;
#ifndef _WIN32
status = PyConfig_SetString(&config, &config.home, interpreter_data.python_home_path);
CHECK_STATUS;
#endif
status = PyConfig_SetString(&config, &config.run_module, L"site");
CHECK_STATUS;
#ifdef _WIN32

View File

@ -82,3 +82,7 @@ def main():
set_quit()
return run_entry_point()
if __name__ == '__main__':
main()

View File

@ -72,7 +72,6 @@ int show_last_error(wchar_t *preamble) {
}
static wchar_t qt_prefix_dir[MAX_PATH] = {0};
static wchar_t w_program_name[MAX_PATH] = {0};
static void
get_app_dirw(void) {
@ -80,11 +79,14 @@ get_app_dirw(void) {
wchar_t drive[4] = L"\0\0\0";
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));
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"));
_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