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

@ -123,6 +123,20 @@ pub fn cp(src string, dst string) ! {
}
}
pub fn rename(src string, dst string) ! {
$if js_node {
err := ''
#try {
#$fs.renameSync(src.str,dst.str);
#return;
#} catch (e) {
#err.str = 'failed to rename ' + src.str + ' to ' + dst.str + ': ' + e.toString();
#}
return error(err)
}
}
pub fn read_file(s string) !string {
mut err := ''
err = err