bin2v: validate .v file extension

pull/5479/head^2
Lukas Neubert 2020-06-24 14:13:31 +02:00 committed by GitHub
parent 30169f86c1
commit 13faf864cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -101,8 +101,11 @@ fn main() {
}
context.files = real_files
if !context.write_file.ends_with('.v') {
context.write_file += '.v'
}
if context.write_file.len > 0 {
mut out_file := os.create('${context.write_file}.v') or { panic(err) }
mut out_file := os.create(context.write_file) or { panic(err) }
out_file.write(context.header())
for file in real_files {
out_file.write(context.file2v(file))