native: append .exe, when using the native backend on windows (#12159)

pull/12162/head
pancake 2021-10-12 17:49:42 +02:00 committed by GitHub
parent a0a0ae85eb
commit 347ebe5fd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -74,10 +74,15 @@ fn get_backend(arch pref.Arch) ?CodeGen {
}
pub fn gen(files []&ast.File, table &ast.Table, out_name string, pref &pref.Preferences) (int, int) {
exe_name := if pref.os == .windows && !out_name.ends_with('.exe') {
out_name + '.exe'
} else {
out_name
}
mut g := &Gen{
table: table
sect_header_name_pos: 0
out_name: out_name
out_name: exe_name
pref: pref
// TODO: workaround, needs to support recursive init
code_gen: get_backend(pref.arch) or {