mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
v.builder: fix building with -cc msvc
and non ASCII characters in paths on windows 11 (#22410)
This commit is contained in:
parent
dc6a9583d7
commit
209c30f3a6
2 changed files with 5 additions and 3 deletions
|
@ -191,6 +191,8 @@ pub fn utf8_str_visible_length(s string) int {
|
||||||
pub fn string_to_ansi_not_null_terminated(_str string) []u8 {
|
pub fn string_to_ansi_not_null_terminated(_str string) []u8 {
|
||||||
wstr := _str.to_wide()
|
wstr := _str.to_wide()
|
||||||
mut ansi := wide_to_ansi(wstr)
|
mut ansi := wide_to_ansi(wstr)
|
||||||
ansi.pop() // remove tailing zero
|
if ansi.len > 0 {
|
||||||
|
unsafe { ansi.len-- } // remove tailing zero
|
||||||
|
}
|
||||||
return ansi
|
return ansi
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,9 +355,9 @@ pub fn (mut v Builder) cc_msvc() {
|
||||||
a << env_ldflags
|
a << env_ldflags
|
||||||
}
|
}
|
||||||
v.dump_c_options(a)
|
v.dump_c_options(a)
|
||||||
args := a.join(' ')
|
args := '\xEF\xBB\xBF' + a.join(' ')
|
||||||
// write args to a file so that we dont smash createprocess
|
// write args to a file so that we dont smash createprocess
|
||||||
os.write_file_array(out_name_cmd_line, string_to_ansi_not_null_terminated(args)) or {
|
os.write_file(out_name_cmd_line, args) or {
|
||||||
verror('Unable to write response file to "${out_name_cmd_line}"')
|
verror('Unable to write response file to "${out_name_cmd_line}"')
|
||||||
}
|
}
|
||||||
cmd := '"${r.full_cl_exe_path}" "@${out_name_cmd_line}"'
|
cmd := '"${r.full_cl_exe_path}" "@${out_name_cmd_line}"'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue