Issue 140 - Fix Open Workspace command for non-Mac platforms (requires Java 6)
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1372 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
9c6097a065
commit
bc6f05f41b
@ -1,5 +1,6 @@
|
||||
package com.google.refine.commands;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -22,11 +23,16 @@ public class OpenWorkspaceDirCommand extends Command {
|
||||
} else if (ProjectManager.singleton instanceof FileProjectManager) {
|
||||
File dir = ((FileProjectManager) ProjectManager.singleton).getWorkspaceDir();
|
||||
|
||||
Runtime.getRuntime().exec(
|
||||
"open .",
|
||||
new String[] {},
|
||||
dir
|
||||
);
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
Desktop desktop = Desktop.getDesktop();
|
||||
desktop.open(dir);
|
||||
} else /* if Mac */ {
|
||||
Process p = Runtime.getRuntime().exec(
|
||||
"open .",
|
||||
new String[] {},
|
||||
dir
|
||||
);
|
||||
}
|
||||
|
||||
respond(response, "{ \"code\" : \"ok\" }");
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user