New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.here file weirdness on windows #12
Comments
Thanks. Yes, the here package caches the location of the project root. The main source of confusion seems to be that this isn't updated by |
ok, thankyou |
- Updated documentation and success message for `set_here()`, now suggests to restart the R session (#12).
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary. |
I am trying to convert all my 'projects' to use here() rather than setwd() but am having random problems with the here() function (and others) not loving the .here files. I'm not able to use rStudio etc so don't have any sort of .project files. I am just trying to use a text editor along with a .here file which I can see in windows explorer but here() is sometimes not recognising them. Here's a short script that I have used to reproduce what I am seeing:
setwd("C:/!Rprojects/heretest/src")
library(here)
packageVersion("here")
packageVersion("rprojroot")
sessionInfo()
getwd()
list.files(".")
list.files("..")
set_here("..")
set_here("..")
list.files(".")
list.files("..")
here()
dr_here()
Before running the test script, the main project directory just contains the following:
data - an empty directory
doco - an empty directory
output - an empty directory
src - a directory containing a single R script with the above code
I have opened a fresh R session to run the commands above
Matrix products: default
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] here_0.1
loaded via a namespace (and not attached):
[1] compiler_3.4.3 backports_1.1.2 rprojroot_1.3-2
.here
[.]Rproj$
with contents matching^Version:
in the first lineDESCRIPTION
with contents matching^Package:
remake.yml
.projectile
.git
.git
with contents matching^gitdir:
.svn
Use set_here() to create a
.here
fileSo, why does the second set_here() call say that the .here file exists and yet the subsequent here() function and dr_here() do not see it there? It's interesting that the second list.files("..") call also does not show the .here file, even though it's after the set_here("..") calls and the .here file certainly exists at that point.
Now, exiting R and starting a fresh session then running the same commands gives a different result.
Matrix products: default
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] here_0.1
loaded via a namespace (and not attached):
[1] compiler_3.4.3 backports_1.1.2 rprojroot_1.3-2
this time through, note the following:
Is there perhaps some sort of cached directory information that's causing the .here file to be not detected by here() after it's been created by set_here() on the first time through? Maybe? Just guessing.
list.files doesn't seem to like the file either, but that's a different issue, though possibly related.
here() looks really promising and I'm loving the idea. just getting confused in trying to actually use it on windows. thanks for any help.
The text was updated successfully, but these errors were encountered: