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

os: make write_file() return an optional

This commit is contained in:
Alexander Medvednikov 2020-06-23 11:41:16 +02:00
parent 3774ae0d91
commit 63ef04e03e

View File

@ -863,9 +863,9 @@ pub fn home_dir() string {
} }
// write_file writes `text` data to a file in `path`. // 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 { mut f := os.create(path) or {
return return error(err)
} }
f.write(text) f.write(text)
f.close() f.close()