mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: add os.mv_by_cp and use it for the temporary files
This commit is contained in:

committed by
Alexander Medvednikov

parent
0cf232d692
commit
a620e66af5
@ -187,6 +187,14 @@ pub fn cp_r(osource_path, odest_path string, overwrite bool) ?bool{
|
||||
return true
|
||||
}
|
||||
|
||||
// mv_by_cp first copies the source file, and if it is copied successfully, deletes the source file.
|
||||
// mv_by_cp may be used when you are not sure that the source and target are on the same mount/partition.
|
||||
pub fn mv_by_cp(source string, target string) ?bool {
|
||||
os.cp(source, target) or { return error(err) }
|
||||
os.rm(source)
|
||||
return true
|
||||
}
|
||||
|
||||
fn vfopen(path, mode string) *C.FILE {
|
||||
$if windows {
|
||||
return C._wfopen(path.to_wide(), mode.to_wide())
|
||||
|
Reference in New Issue
Block a user