My problem may be related to this one. I am trying to create a portable version of RStudio.
The portable version of RStudio crashes on restart if I point to the portable version of R in Tools > Global Options. Please note that I can point the Desktop version to the portable R and it doesn't crash RStudio on restart so I believe there is something wrong with Portable RStudio.
To fix this, I have to delete the RStudio folder in the "C:\Users\username\AppData\Roaming" folder.
To be truly portable, portable RStudio should not use the settings in the Roaming folder. For example, I have RStudio and R installed on the hard drive and changing the R version for portable RStudio also changes it for the Desktop version. I want the two versions to be totally separate.
Please let me know If I can help with troubleshooting.
Does your response help the original poster (Mart) solve his problem too? I don't want to be accused of hijacking Mart's post.
I am not an expert so I wouldn't have the first idea how to use `XDG_CONFIG_HOME. Would I use that in a bat file? Would I have to do this on every machine I need to use the portable version of RStudio (if so, then this is not a portable solution)? Do you think this is the reason portable RStudio isn't working? I don't. And why can't the developers of the portable version fix this so I don't have to figure out how to make it work? I have tred a bunch of different suggestions (except yours) and nothing has fixed the problem.
There are still many unanswered questions. I realize you are not the developer for portable RStudio but maybe you know the right person to contact.
There are a bunch of ways to set environment variables on Windows; the right one depends on your use case. The safest thing to do is to set it during RStudio's launch; you can do that in a batch script or by customizing the RStudio launch shortcut.
Other possibilities include setting it at the user or system level in Windows itself. That might be appropriate if you are using Group Policy or something to manage a large number of Windows instances.
Even portable applications should write user preferences to the Roaming folder! It's how all Windows applications should work. Many "portable" applications need to be able to run from write-protected media, so storing user preferences alongside the application binaries isn't preferred.
I would be surprised if it is, to be honest. Are you seeing the same crash as the original poster? If not, start a new thread and post screenshots and any text you can glean and we'll see what we can figure out.
Before I do that, can you confirm that these are the correct links for portable R and portable RStudio? I think it is possible I don't have the right links.
I unzipped the contents of that file to a folder on an external hard drive called RStudio (F:\RStudio; note that the drive letter will likely change when I plug the drive into different computers).
I already had a copy of R installed on the computer's hard drive so I just copied it to the RStudio folder on the external drive. The path to R is F:\RStudio\R-4.2.2
When RStudio launches, I changed the location of R using Tools > Global Options. The file I selected was located here: F:\RStudio\R-4.2.2\bin\x64\R.exe
After exiting and restarting RStudio, the path to the portable copy of R was found! [By the way, this is where it was crashing before. Maybe I was just selecting the wrong file. To fix, I had to delete the RStudio folder in the C:\Users\username\AppData\Roaming folder. So, this is progress! Thank you very much.]
The only remaining issue is how to keep the location for R for the Desktop version of RStudio separate from that for the portable version of RStudio. In other words, right now when I set the location of R for the portable version of RStudio it also sets the location for the Desktop version of RStudio. It would be ideal if portable RStudio didn't interact at all with the hard drive. I am not sure what the best approach would be but if this can be accomplished with a shortcut parameter we should try that first. Can you give me an example to try out?
Followup: Portable RStudio does not work on computers that don't have R installed. When portable RStudio starts, it pops up a message that R is not installed with no option to point to portable R.