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

os: rework mv so it works with different partitions (add fallback to os.mv_by_cp + tests) (#17065)

This commit is contained in:
Thomas Peißl
2023-01-22 18:02:04 +01:00
committed by GitHub
parent a929466130
commit 3aeb6179b7
4 changed files with 82 additions and 3 deletions

View File

@@ -126,6 +126,11 @@ pub fn mv_by_cp(source string, target string) ! {
rm(source)!
}
// mv moves files or folders from `src` to `dst`.
pub fn mv(source string, target string) ! {
rename(source, target) or { mv_by_cp(source, target)! }
}
// read_lines reads the file in `path` into an array of lines.
[manualfree]
pub fn read_lines(path string) ![]string {