Skip to content

allow customization of project scratch path location - #14875

Merged
gtritchie merged 7 commits into
mainfrom
feature/external-project-scratch-path
Jun 23, 2024
Merged

gtritchie merged 7 commits into
mainfrom
feature/external-project-scratch-path

Conversation

@kevinushey

@kevinushey kevinushey commented Jun 20, 2024 •

Copy link
Copy Markdown
Collaborator

Intent

This PR allows users to customize the project scratch path used by RStudio for any projects they open. (Typically, this is the .Rproj.user folder within a project.)

Addresses: #14778, #7131, #14619

Approach

This is implemented by allowing for a file located at:

.Rproj.user/<userContextId>/scratch-path

This path contains a file, which itself is the external location of the .Rproj.user directory. Conceptually, it's a symlink, but we handle the path resolution by hand to avoid platform-specific concerns.

This file is read on start-up when resolving the scratch path, and can be set by the user via the project options dialog.

Screenshot 2024-06-20 at 10 38 19 PM

Note that both the user-specific and shared scratch data is set when using this setting. For example, after setting the above:

$ tree /tmp/renv/
/tmp/renv/
├── 164C4DDE
│   ├── bibliography-index
│   ├── build_options
│   ├── copilot_options
│   ├── cpp-definition-cache
│   ├── ctx
│   ├── explorer-cache
│   ├── pcs
│   │   ├── debug-breakpoints.pper
│   │   ├── files-pane.pper
│   │   ├── source-pane.pper
│   │   ├── windowlayoutstate.pper
│   │   └── workbench-pane.pper
│   ├── persistent-state
│   ├── presentation
│   ├── profiles-cache
│   ├── rmd-outputs
│   ├── saved_source_markers
│   ├── sources
│   │   ├── per
│   │   │   ├── t
│   │   │   └── u
│   │   └── session-9a2db95c
│   │       ├── 4619CA27
│   │       ├── 4619CA27-contents
│   │       └── lock_file
│   ├── tutorial
│   ├── viewer-cache
│   └── viewer_history
└── shared
    └── notebooks
        └── patch-chunk-names

$ (cd ~/r/pkg/renv; tree .Rproj.user/164C4DDE/)
.Rproj.user/164C4DDE/
└── scratch-path

Automated Tests

TODO

QA Notes

TODO

Documentation

TODO

Checklist

  • If this PR adds a new feature, or fixes a bug in a previously released version, it includes an entry in NEWS.md
  • If this PR adds or changes UI, the updated UI meets accessibility standards
  • A reviewer is assigned to this PR (if unsure who to assign, check Area Owners list)
  • This PR passes all local unit tests

@kevinushey
kevinushey requested a review from gtritchie June 21, 2024 05:27
@kevinushey
kevinushey marked this pull request as ready for review June 21, 2024 18:04

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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.

2 participants