Skip to content

Commit

Permalink
Use file.rename() on Windows with staged install to move package to i…
Browse files Browse the repository at this point in the history
…ts final location.

git-svn-id: https://svn.r-project.org/R/trunk@76171 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
kalibera committed Feb 28, 2019
1 parent 135bdde commit 22a36c8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/library/tools/R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -1599,9 +1599,13 @@ if(FALSE) {

if (pkg_staged_install) {
if (WINDOWS) {
file.copy(instdir, dirname(final_instdir), recursive = TRUE,
copy.date = TRUE)
unlink(instdir, recursive = TRUE)
unlink(final_instdir, recursive = TRUE) # needed for file.rename
if (!file.rename(instdir, final_instdir)) {
message("WARNING: moving package to final location failed, copying instead")
file.copy(instdir, dirname(final_instdir), recursive = TRUE,
copy.date = TRUE)
unlink(instdir, recursive = TRUE)
}
} else {
patch_rpaths()

Expand Down

0 comments on commit 22a36c8

Please sign in to comment.