From 63ef04e03e79a4e582e04efd69def8bb42680732 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 23 Jun 2020 11:41:16 +0200 Subject: [PATCH] os: make write_file() return an optional --- vlib/os/os.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/os/os.v b/vlib/os/os.v index 9c2a379221..524e668bca 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -863,9 +863,9 @@ pub fn home_dir() string { } // write_file writes `text` data to a file in `path`. -pub fn write_file(path, text string) { +pub fn write_file(path, text string) ?{ mut f := os.create(path) or { - return + return error(err) } f.write(text) f.close()