From 13faf864cb106ff6446875ee3b0ca4bf70d1807c Mon Sep 17 00:00:00 2001 From: Lukas Neubert Date: Wed, 24 Jun 2020 14:13:31 +0200 Subject: [PATCH] bin2v: validate .v file extension --- cmd/tools/vbin2v.v | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/tools/vbin2v.v b/cmd/tools/vbin2v.v index 273c40e668..b0e325486b 100644 --- a/cmd/tools/vbin2v.v +++ b/cmd/tools/vbin2v.v @@ -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))