here icon indicating copy to clipboard operation
here copied to clipboard

here often fails to identify directory on google drive on windows

Open rjm001 opened this issue 2 years ago • 3 comments

Hello, I am having trouble with here() on my windows 10 machine. I believe the problem stems from my use of it with google drive. The package and R are both up to date. I am using r studio. When I run a "here()" call from my google drive files, here often fails to find my project folder. Instead, it starts looking for a project in my C drive. This is even if I restart my r session and only have files from my google drive folder open. It's strange, because if I right-click the file and ask Rstudio to "copy path" for the file, it correctly identifies the google drive location. However, if I then run here::here() from the file, it spits out an entirely different and incorrect location. Any suggestions as to what the issue might be? Thanks!

rjm001 avatar Jul 30 '21 21:07 rjm001

I have similar problems using network drives on windows. If I'm in an R-project with the .Rproj-file located in a folder on a network drive, and if I have initialized the project so that my working directory is the same folder (say by opening an r-script in that folder), and run here::here() and getwd(), I get different results.

I can do read operations using here::here() to create paths, like sourcing scripts or reading data files from subfolders, but write operations fail.

m-r-andersson avatar Mar 16 '22 12:03 m-r-andersson

Thanks. What's the output of here::dr_here() ?

krlmlr avatar Mar 16 '22 22:03 krlmlr

Thanks for replying.

Before moving on, let me just say I've just started using here, I'm still learning it and could definitely be doing something wrong. That being said, I've added output of here::dr_here() below. I created the output when I was in an R-project located on a network drive belonging to a company.

here::dr_here()
#> - here() starts at \\srvwinfs01.my-company-network/GemSrv01Data02$/A00007584/projects/my-project.
#> - This directory contains a file matching "[.]Rproj$" with contents matching "^Version: " in the first line
#> - Initial working directory: \\my-company-network/dfs/shared/R/projects/my-project
#> - Current working directory: \\my-company-network/dfs/shared/R/projects/my-project

m-r-andersson avatar Mar 17 '22 06:03 m-r-andersson