Skip to content

Commit

Permalink
tools.vpm: fix moving from temp to vmodules dir (#20152)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Dec 11, 2023
1 parent acde573 commit 4e213f2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/tools/vpm/install.v
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,13 @@ fn (m Module) install() InstallResult {
return .failed
}
}
// TODO: use `os.mv` when working.
mv_cmd := $if windows { 'move' } $else { 'mv' }
os.execute_opt('${mv_cmd} ${os.quoted_path(m.tmp_path)} ${os.quoted_path(m.install_path)}') or {
vpm_error('failed to install `${m.name}`.', details: err.msg())
return .failed
os.mv(m.tmp_path, m.install_path) or {
// `os.mv` / `os.mv_by_cp` from the temp dir to the vmodules dir may fail on some linux systems.
// In such cases, fall back on `os.cp_app`.
os.cp_all(m.tmp_path, m.install_path, true) or {
vpm_error('failed to install `${m.name}`.', details: err.msg())
return .failed
}
}
return .installed
}
Expand Down

0 comments on commit 4e213f2

Please sign in to comment.