talgalili/installr

Function install.URL: should warn if R is installed in a different directory

Opened this issue · 2 comments

Warn if R is installed in a different directory

A bug can appear if:

  • previous version of R is installed in a different directory than the standard one, and the user forgets to change the directory during the setup of the new R version;
  • the new R version will be installed in the standard location: but the previous packages are in a different location;
  • updateR() will not detect the newly installed R version and will exit (even though the installation was succesful, but in the standard directory now);

Solution

The function install.URL should check if R is installed in a non-standard directory and warn the user to change the direcory during the R setup. The code could be inserted in the block of code at line 223:

# Note: this is the existing installr code:
if(is.windows()) {
	shell_output <- shell(install_cmd, wait = wait,...) # system(exe_filename) # I suspect shell works better than system
} else {
	shell_output <- system(install_cmd, wait = wait,...) # system(exe_filename) # I suspect shell works better than system
}

Note:

  • the code mentioned above is the original code from installr;
  • unfortunately, I am not very familiar with the installr code; however, I suspect that any new code will have to be inserted "inside/around" those lines of code;
  • I presume that it is possible to pre-check if the old R is installed in a standard location; if it is not installed in the standard location, then issue a warning about it - but I am unfamiliar with these details;
  • the issue may be also Windows specific;