1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builder: fix v builder error (#16590)

This commit is contained in:
yuyi 2022-12-05 14:48:45 +08:00 committed by GitHub
parent d8d75ee67e
commit ffc73bf643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

View File

@ -981,3 +981,17 @@ fn error_context_lines(text string, keyword string, before int, after int) []str
idx_e := if idx_s + after < lines.len { idx_s + after } else { lines.len }
return lines[idx_s..idx_e]
}
pub fn (mut v Builder) quote_compiler_name(name string) string {
$if windows {
// some compiler frontends on windows, like emcc, are a .bat file on windows.
// Quoting the .bat file name here leads to problems with them, when they internally call python scripts for some reason.
// Just emcc without quotes here does work, but:
// |"emcc" -v| produces: python.exe: can't open file 'D:\programs\v\emcc.py': [Errno 2] No such file or directory
if name.contains('/') || name.contains('\\') {
return os.quoted_path(name)
}
return name
}
return os.quoted_path(name)
}

View File

@ -6,17 +6,6 @@ module builder
import os
import v.pref
pub fn (mut v Builder) quote_compiler_name(name string) string {
// some compiler frontends on windows, like emcc, are a .bat file on windows.
// Quoting the .bat file name here leads to problems with them, when they internally call python scripts for some reason.
// Just emcc without quotes here does work, but:
// |"emcc" -v| produces: python.exe: can't open file 'D:\programs\v\emcc.py': [Errno 2] No such file or directory
if name.contains('/') || name.contains('\\') {
return os.quoted_path(name)
}
return name
}
pub fn (mut v Builder) find_win_cc() ! {
$if !windows {
return