Changes %s to %ls in wprintf in launcher.c for C99 compatibility.
This commit is contained in:
parent
697a526fa1
commit
84bcfb35da
102
PC/launcher.c
102
PC/launcher.c
|
@ -87,13 +87,13 @@ error(int rc, wchar_t * format, ... )
|
||||||
if (rc == 0) { /* a Windows error */
|
if (rc == 0) { /* a Windows error */
|
||||||
winerror(GetLastError(), win_message, MSGSIZE);
|
winerror(GetLastError(), win_message, MSGSIZE);
|
||||||
if (len >= 0) {
|
if (len >= 0) {
|
||||||
_snwprintf_s(&message[len], MSGSIZE - len, _TRUNCATE, L": %s",
|
_snwprintf_s(&message[len], MSGSIZE - len, _TRUNCATE, L": %ls",
|
||||||
win_message);
|
win_message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(_WINDOWS)
|
#if !defined(_WINDOWS)
|
||||||
fwprintf(stderr, L"%s\n", message);
|
fwprintf(stderr, L"%ls\n", message);
|
||||||
#else
|
#else
|
||||||
MessageBox(NULL, message, TEXT("Python Launcher is sorry to say ..."),
|
MessageBox(NULL, message, TEXT("Python Launcher is sorry to say ..."),
|
||||||
MB_OK);
|
MB_OK);
|
||||||
|
@ -202,7 +202,7 @@ locate_pythons_for_key(HKEY root, REGSAM flags)
|
||||||
wchar_t *key_name = (root == HKEY_LOCAL_MACHINE) ? L"HKLM" : L"HKCU";
|
wchar_t *key_name = (root == HKEY_LOCAL_MACHINE) ? L"HKLM" : L"HKCU";
|
||||||
|
|
||||||
if (status != ERROR_SUCCESS)
|
if (status != ERROR_SUCCESS)
|
||||||
debug(L"locate_pythons_for_key: unable to open PythonCore key in %s\n",
|
debug(L"locate_pythons_for_key: unable to open PythonCore key in %ls\n",
|
||||||
key_name);
|
key_name);
|
||||||
else {
|
else {
|
||||||
ip = &installed_pythons[num_installed_pythons];
|
ip = &installed_pythons[num_installed_pythons];
|
||||||
|
@ -212,19 +212,19 @@ locate_pythons_for_key(HKEY root, REGSAM flags)
|
||||||
if (status != ERROR_NO_MORE_ITEMS) {
|
if (status != ERROR_NO_MORE_ITEMS) {
|
||||||
/* unexpected error */
|
/* unexpected error */
|
||||||
winerror(status, message, MSGSIZE);
|
winerror(status, message, MSGSIZE);
|
||||||
debug(L"Can't enumerate registry key for version %s: %s\n",
|
debug(L"Can't enumerate registry key for version %ls: %ls\n",
|
||||||
ip->version, message);
|
ip->version, message);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_snwprintf_s(ip_path, IP_SIZE, _TRUNCATE,
|
_snwprintf_s(ip_path, IP_SIZE, _TRUNCATE,
|
||||||
L"%s\\%s\\InstallPath", CORE_PATH, ip->version);
|
L"%ls\\%ls\\InstallPath", CORE_PATH, ip->version);
|
||||||
status = RegOpenKeyExW(root, ip_path, 0, flags, &ip_key);
|
status = RegOpenKeyExW(root, ip_path, 0, flags, &ip_key);
|
||||||
if (status != ERROR_SUCCESS) {
|
if (status != ERROR_SUCCESS) {
|
||||||
winerror(status, message, MSGSIZE);
|
winerror(status, message, MSGSIZE);
|
||||||
// Note: 'message' already has a trailing \n
|
// Note: 'message' already has a trailing \n
|
||||||
debug(L"%s\\%s: %s", key_name, ip_path, message);
|
debug(L"%ls\\%ls: %ls", key_name, ip_path, message);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
data_size = sizeof(ip->executable) - 1;
|
data_size = sizeof(ip->executable) - 1;
|
||||||
|
@ -233,7 +233,7 @@ locate_pythons_for_key(HKEY root, REGSAM flags)
|
||||||
RegCloseKey(ip_key);
|
RegCloseKey(ip_key);
|
||||||
if (status != ERROR_SUCCESS) {
|
if (status != ERROR_SUCCESS) {
|
||||||
winerror(status, message, MSGSIZE);
|
winerror(status, message, MSGSIZE);
|
||||||
debug(L"%s\\%s: %s\n", key_name, ip_path, message);
|
debug(L"%ls\\%ls: %ls\n", key_name, ip_path, message);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (type == REG_SZ) {
|
if (type == REG_SZ) {
|
||||||
|
@ -246,27 +246,27 @@ locate_pythons_for_key(HKEY root, REGSAM flags)
|
||||||
_snwprintf_s(&ip->executable[data_size],
|
_snwprintf_s(&ip->executable[data_size],
|
||||||
MAX_PATH - data_size,
|
MAX_PATH - data_size,
|
||||||
MAX_PATH - data_size,
|
MAX_PATH - data_size,
|
||||||
L"%s%s", check, PYTHON_EXECUTABLE);
|
L"%ls%ls", check, PYTHON_EXECUTABLE);
|
||||||
attrs = GetFileAttributesW(ip->executable);
|
attrs = GetFileAttributesW(ip->executable);
|
||||||
if (attrs == INVALID_FILE_ATTRIBUTES) {
|
if (attrs == INVALID_FILE_ATTRIBUTES) {
|
||||||
winerror(GetLastError(), message, MSGSIZE);
|
winerror(GetLastError(), message, MSGSIZE);
|
||||||
debug(L"locate_pythons_for_key: %s: %s",
|
debug(L"locate_pythons_for_key: %ls: %ls",
|
||||||
ip->executable, message);
|
ip->executable, message);
|
||||||
}
|
}
|
||||||
else if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
|
else if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
debug(L"locate_pythons_for_key: '%s' is a \
|
debug(L"locate_pythons_for_key: '%ls' is a \
|
||||||
directory\n",
|
directory\n",
|
||||||
ip->executable, attrs);
|
ip->executable, attrs);
|
||||||
}
|
}
|
||||||
else if (find_existing_python(ip->executable)) {
|
else if (find_existing_python(ip->executable)) {
|
||||||
debug(L"locate_pythons_for_key: %s: already \
|
debug(L"locate_pythons_for_key: %ls: already \
|
||||||
found: %s\n", ip->executable);
|
found: %ls\n", ip->executable);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* check the executable type. */
|
/* check the executable type. */
|
||||||
ok = GetBinaryTypeW(ip->executable, &attrs);
|
ok = GetBinaryTypeW(ip->executable, &attrs);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
debug(L"Failure getting binary type: %s\n",
|
debug(L"Failure getting binary type: %ls\n",
|
||||||
ip->executable);
|
ip->executable);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -277,7 +277,7 @@ found: %s\n", ip->executable);
|
||||||
else
|
else
|
||||||
ip->bits = 0;
|
ip->bits = 0;
|
||||||
if (ip->bits == 0) {
|
if (ip->bits == 0) {
|
||||||
debug(L"locate_pythons_for_key: %s: \
|
debug(L"locate_pythons_for_key: %ls: \
|
||||||
invalid binary type: %X\n",
|
invalid binary type: %X\n",
|
||||||
ip->executable, attrs);
|
ip->executable, attrs);
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ invalid binary type: %X\n",
|
||||||
ip->executable[n + 1] = L'\"';
|
ip->executable[n + 1] = L'\"';
|
||||||
ip->executable[n + 2] = L'\0';
|
ip->executable[n + 2] = L'\0';
|
||||||
}
|
}
|
||||||
debug(L"locate_pythons_for_key: %s \
|
debug(L"locate_pythons_for_key: %ls \
|
||||||
is a %dbit executable\n",
|
is a %dbit executable\n",
|
||||||
ip->executable, ip->bits);
|
ip->executable, ip->bits);
|
||||||
++num_installed_pythons;
|
++num_installed_pythons;
|
||||||
|
@ -397,7 +397,7 @@ get_configured_value(wchar_t * key)
|
||||||
DWORD size;
|
DWORD size;
|
||||||
|
|
||||||
/* First, search the environment. */
|
/* First, search the environment. */
|
||||||
_snwprintf_s(configured_value, MSGSIZE, _TRUNCATE, L"py_%s", key);
|
_snwprintf_s(configured_value, MSGSIZE, _TRUNCATE, L"py_%ls", key);
|
||||||
result = get_env(configured_value);
|
result = get_env(configured_value);
|
||||||
if (result == NULL && appdata_ini_path[0]) {
|
if (result == NULL && appdata_ini_path[0]) {
|
||||||
/* Not in environment: check local configuration. */
|
/* Not in environment: check local configuration. */
|
||||||
|
@ -420,10 +420,10 @@ get_configured_value(wchar_t * key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result) {
|
if (result) {
|
||||||
debug(L"found configured value '%s=%s' in %s\n",
|
debug(L"found configured value '%ls=%ls' in %ls\n",
|
||||||
key, result, found_in ? found_in : L"(unknown)");
|
key, result, found_in ? found_in : L"(unknown)");
|
||||||
} else {
|
} else {
|
||||||
debug(L"found no configured value for '%s'\n", key);
|
debug(L"found no configured value for '%ls'\n", key);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -449,9 +449,9 @@ locate_python(wchar_t * wanted_ver)
|
||||||
}
|
}
|
||||||
if (*wanted_ver) {
|
if (*wanted_ver) {
|
||||||
result = find_python_by_version(wanted_ver);
|
result = find_python_by_version(wanted_ver);
|
||||||
debug(L"search for Python version '%s' found ", wanted_ver);
|
debug(L"search for Python version '%ls' found ", wanted_ver);
|
||||||
if (result) {
|
if (result) {
|
||||||
debug(L"'%s'\n", result->executable);
|
debug(L"'%ls'\n", result->executable);
|
||||||
} else {
|
} else {
|
||||||
debug(L"no interpreter\n");
|
debug(L"no interpreter\n");
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,7 @@ locate_python(wchar_t * wanted_ver)
|
||||||
result = find_python_by_version(L"3");
|
result = find_python_by_version(L"3");
|
||||||
debug(L"search for default Python found ");
|
debug(L"search for default Python found ");
|
||||||
if (result) {
|
if (result) {
|
||||||
debug(L"version %s at '%s'\n",
|
debug(L"version %ls at '%ls'\n",
|
||||||
result->version, result->executable);
|
result->version, result->executable);
|
||||||
} else {
|
} else {
|
||||||
debug(L"no interpreter\n");
|
debug(L"no interpreter\n");
|
||||||
|
@ -505,19 +505,19 @@ locate_wrapped_script()
|
||||||
plen = GetModuleFileNameW(NULL, wrapped_script_path, MAX_PATH);
|
plen = GetModuleFileNameW(NULL, wrapped_script_path, MAX_PATH);
|
||||||
p = wcsrchr(wrapped_script_path, L'.');
|
p = wcsrchr(wrapped_script_path, L'.');
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
debug(L"GetModuleFileNameW returned value has no extension: %s\n",
|
debug(L"GetModuleFileNameW returned value has no extension: %ls\n",
|
||||||
wrapped_script_path);
|
wrapped_script_path);
|
||||||
error(RC_NO_SCRIPT, L"Wrapper name '%s' is not valid.", wrapped_script_path);
|
error(RC_NO_SCRIPT, L"Wrapper name '%ls' is not valid.", wrapped_script_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
wcsncpy_s(p, MAX_PATH - (p - wrapped_script_path) + 1, SCRIPT_SUFFIX, _TRUNCATE);
|
wcsncpy_s(p, MAX_PATH - (p - wrapped_script_path) + 1, SCRIPT_SUFFIX, _TRUNCATE);
|
||||||
attrs = GetFileAttributesW(wrapped_script_path);
|
attrs = GetFileAttributesW(wrapped_script_path);
|
||||||
if (attrs == INVALID_FILE_ATTRIBUTES) {
|
if (attrs == INVALID_FILE_ATTRIBUTES) {
|
||||||
debug(L"File '%s' non-existent\n", wrapped_script_path);
|
debug(L"File '%ls' non-existent\n", wrapped_script_path);
|
||||||
error(RC_NO_SCRIPT, L"Script file '%s' is not present.", wrapped_script_path);
|
error(RC_NO_SCRIPT, L"Script file '%ls' is not present.", wrapped_script_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(L"Using wrapped script file '%s'\n", wrapped_script_path);
|
debug(L"Using wrapped script file '%ls'\n", wrapped_script_path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -579,7 +579,7 @@ run_child(wchar_t * cmdline)
|
||||||
GetMessage(&msg, 0, 0, 0);
|
GetMessage(&msg, 0, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
debug(L"run_child: about to run '%s'\n", cmdline);
|
debug(L"run_child: about to run '%ls'\n", cmdline);
|
||||||
job = CreateJobObject(NULL, NULL);
|
job = CreateJobObject(NULL, NULL);
|
||||||
ok = QueryInformationJobObject(job, JobObjectExtendedLimitInformation,
|
ok = QueryInformationJobObject(job, JobObjectExtendedLimitInformation,
|
||||||
&info, sizeof(info), &rc);
|
&info, sizeof(info), &rc);
|
||||||
|
@ -611,7 +611,7 @@ run_child(wchar_t * cmdline)
|
||||||
ok = CreateProcessW(NULL, cmdline, NULL, NULL, TRUE,
|
ok = CreateProcessW(NULL, cmdline, NULL, NULL, TRUE,
|
||||||
0, NULL, NULL, &si, &pi);
|
0, NULL, NULL, &si, &pi);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
error(RC_CREATE_PROCESS, L"Unable to create process using '%s'", cmdline);
|
error(RC_CREATE_PROCESS, L"Unable to create process using '%ls'", cmdline);
|
||||||
AssignProcessToJobObject(job, pi.hProcess);
|
AssignProcessToJobObject(job, pi.hProcess);
|
||||||
CloseHandle(pi.hThread);
|
CloseHandle(pi.hThread);
|
||||||
WaitForSingleObjectEx(pi.hProcess, INFINITE, FALSE);
|
WaitForSingleObjectEx(pi.hProcess, INFINITE, FALSE);
|
||||||
|
@ -648,11 +648,11 @@ invoke_child(wchar_t * executable, wchar_t * suffix, wchar_t * cmdline)
|
||||||
child_command_size);
|
child_command_size);
|
||||||
if (no_suffix)
|
if (no_suffix)
|
||||||
_snwprintf_s(child_command, child_command_size,
|
_snwprintf_s(child_command, child_command_size,
|
||||||
child_command_size - 1, L"%s %s",
|
child_command_size - 1, L"%ls %ls",
|
||||||
executable, cmdline);
|
executable, cmdline);
|
||||||
else
|
else
|
||||||
_snwprintf_s(child_command, child_command_size,
|
_snwprintf_s(child_command, child_command_size,
|
||||||
child_command_size - 1, L"%s %s %s",
|
child_command_size - 1, L"%ls %ls %ls",
|
||||||
executable, suffix, cmdline);
|
executable, suffix, cmdline);
|
||||||
run_child(child_command);
|
run_child(child_command);
|
||||||
free(child_command);
|
free(child_command);
|
||||||
|
@ -791,7 +791,7 @@ static void
|
||||||
add_command(wchar_t * name, wchar_t * cmdline)
|
add_command(wchar_t * name, wchar_t * cmdline)
|
||||||
{
|
{
|
||||||
if (num_commands >= MAX_COMMANDS) {
|
if (num_commands >= MAX_COMMANDS) {
|
||||||
debug(L"can't add %s = '%s': no room\n", name, cmdline);
|
debug(L"can't add %ls = '%ls': no room\n", name, cmdline);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
COMMAND * cp = &commands[num_commands++];
|
COMMAND * cp = &commands[num_commands++];
|
||||||
|
@ -813,14 +813,14 @@ read_config_file(wchar_t * config_path)
|
||||||
read = GetPrivateProfileStringW(L"commands", NULL, NULL, keynames, MSGSIZE,
|
read = GetPrivateProfileStringW(L"commands", NULL, NULL, keynames, MSGSIZE,
|
||||||
config_path);
|
config_path);
|
||||||
if (read == MSGSIZE - 1) {
|
if (read == MSGSIZE - 1) {
|
||||||
debug(L"read_commands: %s: not enough space for names\n", config_path);
|
debug(L"read_commands: %ls: not enough space for names\n", config_path);
|
||||||
}
|
}
|
||||||
key = keynames;
|
key = keynames;
|
||||||
while (*key) {
|
while (*key) {
|
||||||
read = GetPrivateProfileStringW(L"commands", key, NULL, value, MSGSIZE,
|
read = GetPrivateProfileStringW(L"commands", key, NULL, value, MSGSIZE,
|
||||||
config_path);
|
config_path);
|
||||||
if (read == MSGSIZE - 1) {
|
if (read == MSGSIZE - 1) {
|
||||||
debug(L"read_commands: %s: not enough space for %s\n",
|
debug(L"read_commands: %ls: not enough space for %ls\n",
|
||||||
config_path, key);
|
config_path, key);
|
||||||
}
|
}
|
||||||
cmdp = skip_whitespace(value);
|
cmdp = skip_whitespace(value);
|
||||||
|
@ -1097,7 +1097,7 @@ maybe_handle_shebang(wchar_t ** argv, wchar_t * cmdline)
|
||||||
if ((read >= 4) && (buffer[3] == '\n') && (buffer[2] == '\r')) {
|
if ((read >= 4) && (buffer[3] == '\n') && (buffer[2] == '\r')) {
|
||||||
ip = find_by_magic((buffer[1] << 8 | buffer[0]) & 0xFFFF);
|
ip = find_by_magic((buffer[1] << 8 | buffer[0]) & 0xFFFF);
|
||||||
if (ip != NULL) {
|
if (ip != NULL) {
|
||||||
debug(L"script file is compiled against Python %s\n",
|
debug(L"script file is compiled against Python %ls\n",
|
||||||
ip->version);
|
ip->version);
|
||||||
invoke_child(ip->executable, NULL, cmdline);
|
invoke_child(ip->executable, NULL, cmdline);
|
||||||
}
|
}
|
||||||
|
@ -1200,7 +1200,7 @@ of bytes: %d\n", header_len);
|
||||||
is_virt = parse_shebang(shebang_line, nchars, &command,
|
is_virt = parse_shebang(shebang_line, nchars, &command,
|
||||||
&suffix, &search);
|
&suffix, &search);
|
||||||
if (command != NULL) {
|
if (command != NULL) {
|
||||||
debug(L"parse_shebang: found command: %s\n", command);
|
debug(L"parse_shebang: found command: %ls\n", command);
|
||||||
if (!is_virt) {
|
if (!is_virt) {
|
||||||
invoke_child(command, suffix, cmdline);
|
invoke_child(command, suffix, cmdline);
|
||||||
}
|
}
|
||||||
|
@ -1212,7 +1212,7 @@ of bytes: %d\n", header_len);
|
||||||
}
|
}
|
||||||
if (wcsncmp(command, L"python", 6))
|
if (wcsncmp(command, L"python", 6))
|
||||||
error(RC_BAD_VIRTUAL_PATH, L"Unknown virtual \
|
error(RC_BAD_VIRTUAL_PATH, L"Unknown virtual \
|
||||||
path '%s'", command);
|
path '%ls'", command);
|
||||||
command += 6; /* skip past "python" */
|
command += 6; /* skip past "python" */
|
||||||
if (search && ((*command == L'\0') || isspace(*command))) {
|
if (search && ((*command == L'\0') || isspace(*command))) {
|
||||||
/* Command is eligible for path search, and there
|
/* Command is eligible for path search, and there
|
||||||
|
@ -1220,9 +1220,9 @@ path '%s'", command);
|
||||||
*/
|
*/
|
||||||
debug(L"searching PATH for python executable\n");
|
debug(L"searching PATH for python executable\n");
|
||||||
cmd = find_on_path(L"python");
|
cmd = find_on_path(L"python");
|
||||||
debug(L"Python on path: %s\n", cmd ? cmd->value : L"<not found>");
|
debug(L"Python on path: %ls\n", cmd ? cmd->value : L"<not found>");
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
debug(L"located python on PATH: %s\n", cmd->value);
|
debug(L"located python on PATH: %ls\n", cmd->value);
|
||||||
invoke_child(cmd->value, suffix, cmdline);
|
invoke_child(cmd->value, suffix, cmdline);
|
||||||
/* Exit here, as we have found the command */
|
/* Exit here, as we have found the command */
|
||||||
return;
|
return;
|
||||||
|
@ -1233,14 +1233,14 @@ path '%s'", command);
|
||||||
}
|
}
|
||||||
if (*command && !validate_version(command))
|
if (*command && !validate_version(command))
|
||||||
error(RC_BAD_VIRTUAL_PATH, L"Invalid version \
|
error(RC_BAD_VIRTUAL_PATH, L"Invalid version \
|
||||||
specification: '%s'.\nIn the first line of the script, 'python' needs to be \
|
specification: '%ls'.\nIn the first line of the script, 'python' needs to be \
|
||||||
followed by a valid version specifier.\nPlease check the documentation.",
|
followed by a valid version specifier.\nPlease check the documentation.",
|
||||||
command);
|
command);
|
||||||
/* TODO could call validate_version(command) */
|
/* TODO could call validate_version(command) */
|
||||||
ip = locate_python(command);
|
ip = locate_python(command);
|
||||||
if (ip == NULL) {
|
if (ip == NULL) {
|
||||||
error(RC_NO_PYTHON, L"Requested Python version \
|
error(RC_NO_PYTHON, L"Requested Python version \
|
||||||
(%s) is not installed", command);
|
(%ls) is not installed", command);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
invoke_child(ip->executable, suffix, cmdline);
|
invoke_child(ip->executable, suffix, cmdline);
|
||||||
|
@ -1347,17 +1347,17 @@ process(int argc, wchar_t ** argv)
|
||||||
wcsncpy_s(p, MAX_PATH - plen, L"\\py.ini", _TRUNCATE);
|
wcsncpy_s(p, MAX_PATH - plen, L"\\py.ini", _TRUNCATE);
|
||||||
attrs = GetFileAttributesW(appdata_ini_path);
|
attrs = GetFileAttributesW(appdata_ini_path);
|
||||||
if (attrs == INVALID_FILE_ATTRIBUTES) {
|
if (attrs == INVALID_FILE_ATTRIBUTES) {
|
||||||
debug(L"File '%s' non-existent\n", appdata_ini_path);
|
debug(L"File '%ls' non-existent\n", appdata_ini_path);
|
||||||
appdata_ini_path[0] = L'\0';
|
appdata_ini_path[0] = L'\0';
|
||||||
} else {
|
} else {
|
||||||
debug(L"Using local configuration file '%s'\n", appdata_ini_path);
|
debug(L"Using local configuration file '%ls'\n", appdata_ini_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plen = GetModuleFileNameW(NULL, launcher_ini_path, MAX_PATH);
|
plen = GetModuleFileNameW(NULL, launcher_ini_path, MAX_PATH);
|
||||||
size = GetFileVersionInfoSizeW(launcher_ini_path, &size);
|
size = GetFileVersionInfoSizeW(launcher_ini_path, &size);
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
winerror(GetLastError(), message, MSGSIZE);
|
winerror(GetLastError(), message, MSGSIZE);
|
||||||
debug(L"GetFileVersionInfoSize failed: %s\n", message);
|
debug(L"GetFileVersionInfoSize failed: %ls\n", message);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
version_data = malloc(size);
|
version_data = malloc(size);
|
||||||
|
@ -1381,7 +1381,7 @@ process(int argc, wchar_t ** argv)
|
||||||
}
|
}
|
||||||
p = wcsrchr(launcher_ini_path, L'\\');
|
p = wcsrchr(launcher_ini_path, L'\\');
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
debug(L"GetModuleFileNameW returned value has no backslash: %s\n",
|
debug(L"GetModuleFileNameW returned value has no backslash: %ls\n",
|
||||||
launcher_ini_path);
|
launcher_ini_path);
|
||||||
launcher_ini_path[0] = L'\0';
|
launcher_ini_path[0] = L'\0';
|
||||||
}
|
}
|
||||||
|
@ -1390,15 +1390,15 @@ process(int argc, wchar_t ** argv)
|
||||||
_TRUNCATE);
|
_TRUNCATE);
|
||||||
attrs = GetFileAttributesW(launcher_ini_path);
|
attrs = GetFileAttributesW(launcher_ini_path);
|
||||||
if (attrs == INVALID_FILE_ATTRIBUTES) {
|
if (attrs == INVALID_FILE_ATTRIBUTES) {
|
||||||
debug(L"File '%s' non-existent\n", launcher_ini_path);
|
debug(L"File '%ls' non-existent\n", launcher_ini_path);
|
||||||
launcher_ini_path[0] = L'\0';
|
launcher_ini_path[0] = L'\0';
|
||||||
} else {
|
} else {
|
||||||
debug(L"Using global configuration file '%s'\n", launcher_ini_path);
|
debug(L"Using global configuration file '%ls'\n", launcher_ini_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
command = skip_me(GetCommandLineW());
|
command = skip_me(GetCommandLineW());
|
||||||
debug(L"Called with command line: %s\n", command);
|
debug(L"Called with command line: %ls\n", command);
|
||||||
|
|
||||||
#if defined(SCRIPT_WRAPPER)
|
#if defined(SCRIPT_WRAPPER)
|
||||||
/* The launcher is being used in "script wrapper" mode.
|
/* The launcher is being used in "script wrapper" mode.
|
||||||
|
@ -1422,7 +1422,7 @@ process(int argc, wchar_t ** argv)
|
||||||
wcscpy_s(newcommand, newlen, wrapped_script_path);
|
wcscpy_s(newcommand, newlen, wrapped_script_path);
|
||||||
wcscat_s(newcommand, newlen, L" ");
|
wcscat_s(newcommand, newlen, L" ");
|
||||||
wcscat_s(newcommand, newlen, command);
|
wcscat_s(newcommand, newlen, command);
|
||||||
debug(L"Running wrapped script with command line '%s'\n", newcommand);
|
debug(L"Running wrapped script with command line '%ls'\n", newcommand);
|
||||||
read_commands();
|
read_commands();
|
||||||
av[0] = wrapped_script_path;
|
av[0] = wrapped_script_path;
|
||||||
av[1] = NULL;
|
av[1] = NULL;
|
||||||
|
@ -1443,7 +1443,7 @@ process(int argc, wchar_t ** argv)
|
||||||
if (valid) {
|
if (valid) {
|
||||||
ip = locate_python(&p[1]);
|
ip = locate_python(&p[1]);
|
||||||
if (ip == NULL)
|
if (ip == NULL)
|
||||||
error(RC_NO_PYTHON, L"Requested Python version (%s) not \
|
error(RC_NO_PYTHON, L"Requested Python version (%ls) not \
|
||||||
installed", &p[1]);
|
installed", &p[1]);
|
||||||
command += wcslen(p);
|
command += wcslen(p);
|
||||||
command = skip_whitespace(command);
|
command = skip_whitespace(command);
|
||||||
|
@ -1476,9 +1476,9 @@ installed", &p[1]);
|
||||||
|
|
||||||
get_version_info(version_text, MAX_PATH);
|
get_version_info(version_text, MAX_PATH);
|
||||||
fwprintf(stdout, L"\
|
fwprintf(stdout, L"\
|
||||||
Python Launcher for Windows Version %s\n\n", version_text);
|
Python Launcher for Windows Version %ls\n\n", version_text);
|
||||||
fwprintf(stdout, L"\
|
fwprintf(stdout, L"\
|
||||||
usage: %s [ launcher-arguments ] [ python-arguments ] script [ script-arguments ]\n\n", argv[0]);
|
usage: %ls [ launcher-arguments ] [ python-arguments ] script [ script-arguments ]\n\n", argv[0]);
|
||||||
fputws(L"\
|
fputws(L"\
|
||||||
Launcher arguments:\n\n\
|
Launcher arguments:\n\n\
|
||||||
-2 : Launch the latest Python 2.x version\n\
|
-2 : Launch the latest Python 2.x version\n\
|
||||||
|
|
Loading…
Reference in New Issue