RStudio file explorer in wrong directory upon startup

Hi all!

A few months ago, RStudio file explorer started showing a different directory upon startup. I was wondering if anyone knew how this could be changed back to how it was before. I work primarily on 1 project, I user a project file and I need the root of the project to stay where it is.

Here is an example of the directory structure:

      |---Dir3 (root as defined by project file)
             |--- subDir1
             |--- subDir2
             |--- subDir3

At startup, file explorer used to be in subDir2, now it is always in subDir3.

Thanks in advance!

If you close your RStudio Project, then reopen it by clicking on the .Rproj file inside Dir3, are you still in the subDir3 when it opens ?

Yes. This is how I usually open my work, by clicking on the .Rproj file in Dir3 in the Windows File Explorer.

Maybe I should clarify: the working directory is set fine; I am referring to the Files Pane.

Maybe the project saves in a way the last path opened in File Explorer.
Did you try navigating back to the correct folder then closing the project and reopening ? In that case, is the subdir3 path also restored whereas you had set it back to Dir3 just before closing ?

I just tried myself and I can confirm that the last open path in file explorer is restored when you open. RStudio saves the state of the IDE to be restored afterward.You can easily get back to your project root dir by clicking on the blue box in the File pane

That was my first thought, too, and I have tried what you suggested before but the problem persists. But I always work in subdir2 and hardly open subdir3, which is why it surprised me that it suddenly now always opens up in subdir3. This happened "over night" so to speak, without me making any changes, and now I cannot get rid of it.

I can't reproduce this so it is difficult for me to investigate further. I shared my ideas already.

  • Clicking on the blue box gets you back on the RStudio project root in the file pane
  • this path should be the working directory for your project
  • The file pane keeps the state of the last opened path and restored it later.

I don't have anymore ideas, maybe someone else will.

Thanks for trying Christophe!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.