Skip to content
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

Using R.cache.rootPath.ask or R_CACHE_ROOTPATH_ASK sys. env. #43

Closed
wants to merge 2 commits into from

Conversation

arekbee
Copy link

@arekbee arekbee commented Nov 19, 2020

With ver. 0.14.0, behavior of loaded library has change
In interactive mode (in RStudio) I will get a blocking message to create ~/.cache/R/R.cache/ path.
This is blocking our Shiny apps.
Maybe setting R option or system variable will not force to prompt the message.

If R.cache.rootPath.ask option or R_CACHE_ROOTPATH_ASK system variable will be false then prompt will not appear
R.cache.rootPath.ask has priority over R_CACHE_ROOTPATH_ASK

@codecov-io
Copy link

Codecov Report

Merging #43 (bdc3a2a) into develop (b4ea219) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop      #43   +/-   ##
========================================
  Coverage    67.65%   67.65%           
========================================
  Files           23       23           
  Lines          405      405           
========================================
  Hits           274      274           
  Misses         131      131           
Impacted Files Coverage Δ
R/setupCacheRootPath.R 52.38% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df9a716...bdc3a2a. Read the comment docs.

@lorenzwalthert
Copy link

I'd also like this feature. It came up in dreamRs/esquisse#168.

@HenrikBengtsson
Copy link
Owner

With ver. 0.14.0, behavior of loaded library has change
In interactive mode (in RStudio) I will get a blocking message to create ~/.cache/R/R.cache/ path.

This should have been fixed in R.cache 0.15.0 (2021-04-27). From the NEWS file:

R.cache/NEWS

Lines 17 to 18 in 2a543be

* The package will no longer ask for permission to create the cache folder
as long as the cache folder is compatible with tools::R_user_dir().

For non-standard cache folders, the CRAN policy is that we must have the user's permission to create folders. However, if the folder already exists, then R.cache does of course not have to ask for permission to create it, which is how R.cache always have worked.

Thus, the following should work without R.cache prompting the user:

> my_path <- file.path(tempdir(), "foo")
> dir.create(my_path, recursive = TRUE)

> options(R.cache.rootPath = my_path)
> path <- R.cache::getCachePath(dirs = "bar")
> path
[1] "/tmp/hb/RtmpdZuzuK/foo/bar"

Does this cover what you need?

@lorenzwalthert
Copy link

Perfect, thanks for the detailed explanation, this completely solves the problem. Will require R.cache >= 0.15.0 in {styler}.

@HenrikBengtsson
Copy link
Owner

This should have been fixed in R.cache 0.15.0 (2021-04-27).

I'll assume this fixed it, so I'll close. If not, please create an issue explaining the problem.

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.

4 participants