What does "Synchronize Working Directory" in RStudio Files > More ... do?

In RStudio (Version 2024.09.1+394), there is an option "Synchronize Working Directory" in the Files pane under More. It seems to toggle a state since choosing it alternately adds or removes a checkmark, but I can't find any documentation or web posts.

I am curious because I am trying to figure out "idiot-proof" control of R's working directory for teaching purposes. (I have already found the here package and project-oriented workflows.)

Thanks for any help!

AFAIK, if ON, it updates the Files pane to show the current working directory if it is changed with setwd().

@mduvekot: Thank you for the suggestion.

I just checked, though, and the File pane switches to the current working directory when I change it with setwd(), regardless of the checkmark on "Synchronize Working Directory." I can't find any option for such a synchronization in the Preferences (other than setting the Default working directory). Maybe it was made the unmutable default behavior during an update to RStudio, and the menu option was left behind.

Curious. On my system (Linux Mint, RStudio build 394), it is as @mduvekot suggested. If I change working directory via setwd() in the console with the synch option unchecked (my default status), the Files pane does not react. With it checked, the Files pane switches to the new working directory.

I'm running RStudio 2024.9.1.394 on OSX Sequoia 15.1.1. Perhaps that makes a difference?

The behavior in my previous post happened when I opened RStudio (build 394, Monterey 12.7.6) by itself.

When I open a Quarto file that lives in a project folder together with its .RProj file and the project is controlled by renv, the checkmark on Synchronize ... does make a difference.

Looks like RStudio does some work on the current working directory behind the scenes, depending on startup conditions.

The checkmark behaves as expected when I open RStudio without any projects or files. I wonder if something in RStudio's state has synchronization stuck in the on position regardless of the checkmark, and that gets overridden by project-specific settings? Resetting RStudio's state might answer that question, although it may not be worth the effort (unless having synchronization on presents a problem for some reason).