Skip to content

Conversation

@andycraig
Copy link
Collaborator

Fixes #176

Updates README to give path for init.R that is correct on Windows. (It was already correct on Linux/Mac.)

I have tested that this works on Windows and Linux.

@jacob-long I think you are a Windows user too? If you would be able to confirm that this works for you too that would be great.

@Ikuyadeu
Copy link
Member

Ikuyadeu commented Jan 8, 2020

@andycraig Great! Thank you for applying for Windows!

@Ikuyadeu Ikuyadeu merged commit 05ea454 into REditorSupport:master Jan 8, 2020
@renkun-ken
Copy link
Member

@andycraig I'm playing around with a Windows 10 in virtualbox. I notice there's an environment variable USERPROFILE which happens to be the user home directory. Not sure if we can use this?

@andycraig
Copy link
Collaborator Author

@renkun-ken Good find! I tried USERPROFILE it does indeed point to the right location on my Windows PC. But I did some more reading and apparently USERPROFILE and HOMEDRIVE/HOMEPATH don't necessarily point to the same place: https://stackoverflow.com/a/8797855

From os.homedir() docs: 'On Windows, it uses the USERPROFILE environment variable if defined. Otherwise it uses the path to the profile directory of the current user.'

A couple more options:

  1. Rather than having users copy code from README into .Rprofile, provide a vscode-R command that writes the output of os.homedir() to .Rprofile. That would still fail if the user's environment variables changed after that, though.
  2. Look at the source code of os.homedir() and try to duplicate that logic in the code to go in .Rprofile.

@andycraig
Copy link
Collaborator Author

@renkun-ken For now, using USERPROFILE rather than HOMEDRIVE/HOMEPATH would probably be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't find init.R on Windows for session watcher

3 participants