os: add info about overwritten content to `write_file` (#14109)

master
Larpon 2022-04-20 14:29:58 +02:00 committed by GitHub
parent 52ea0b8cc3
commit a1342e85c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -367,7 +367,8 @@ pub fn expand_tilde_to_home(path string) string {
return path return path
} }
// write_file writes `text` data to a file in `path`. // write_file writes `text` data to the file in `path`.
// If `path` exists already, the contents of `path` will be overwritten with the contents of `text`.
pub fn write_file(path string, text string) ? { pub fn write_file(path string, text string) ? {
mut f := create(path) ? mut f := create(path) ?
unsafe { f.write_full_buffer(text.str, usize(text.len)) ? } unsafe { f.write_full_buffer(text.str, usize(text.len)) ? }