Skip to content

Commit

Permalink
use project derived r environment directory for workspace save
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Jun 23, 2011
1 parent 3c4ba7b commit 98ea8b3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/cpp/session/SessionMain.cpp
Expand Up @@ -1724,6 +1724,7 @@ void detectParentTermination()
}
}

// NOTE: mirrors behavior of WorkbenchContext.getREnvironmentPath on the client
FilePath rEnvironmentDir()
{
// for projects we always use the project directory
Expand Down
@@ -1,6 +1,5 @@
package org.rstudio.studio.client.projects;

import org.rstudio.core.client.Debug;
import org.rstudio.core.client.command.CommandBinder;
import org.rstudio.core.client.command.Handler;
import org.rstudio.core.client.widget.MessageDialog;
Expand Down
Expand Up @@ -61,18 +61,28 @@ public void setDefaultFileDialogDir(FileSystemItem dir)
defaultFileDialogDir_ = dir;
}

// mirrors behavior of rEnvironmentDir in SessionMain.cpp
// NOTE: mirrors behavior of rEnvironmentDir in SessionMain.cpp
public String getREnvironmentPath()
{
SessionInfo sessionInfo = session_.getSessionInfo();
if (sessionInfo != null)
{
FileSystemItem rEnvDir = null;

if (sessionInfo.getActiveProjectFile() != null)
{
rEnvDir = FileSystemItem.createFile(
sessionInfo.getActiveProjectFile()).getParentPath();
}
if (sessionInfo.getMode().equals(SessionInfo.DESKTOP_MODE))
{
rEnvDir = currentWorkingDir_;
}
else
{
rEnvDir = FileSystemItem.createDir(
sessionInfo.getInitialWorkingDir());
}
return rEnvDir.completePath(".RData");
}
else
Expand Down
Expand Up @@ -241,9 +241,9 @@ public void execute(ProgressIndicator indicator)

private void sendDefaultWorkspaceCommandToConsole(String command)
{
FileSystemItem cwd = workbenchContext_.getCurrentWorkingDir();
FileSystemItem wsPath = FileSystemItem.createFile(cwd.completePath(".RData"));
consoleDispatcher_.executeCommand(command, wsPath);
String renvPath = workbenchContext_.getREnvironmentPath();
consoleDispatcher_.executeCommand(command,
FileSystemItem.createFile(renvPath));
}


Expand Down

0 comments on commit 98ea8b3

Please sign in to comment.