|
From: <caw...@us...> - 2007-08-15 14:40:50
|
Revision: 2979
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2979&view=rev
Author: cawilliams
Date: 2007-08-15 07:40:47 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
move setting PATH in environment array into a protected getEnvironment() method, and use that in both normal runner and debugger run() methods
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-08-15 14:16:41 UTC (rev 2978)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-08-15 14:40:47 UTC (rev 2979)
@@ -89,7 +89,7 @@
String[] cmdLine = new String[arguments.size()];
arguments.toArray(cmdLine);
- String[] envp = config.getEnvironment();
+ String[] envp = getEnvironment(config);
// check for cancellation
if (monitor.isCanceled()) {
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-15 14:16:41 UTC (rev 2978)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-15 14:40:47 UTC (rev 2979)
@@ -243,24 +243,7 @@
String[] cmdLine= new String[arguments.size()];
arguments.toArray(cmdLine);
- String[] env2;
- String[] envp= config.getEnvironment();
- if (!Platform.getOS().equals(Platform.OS_WIN32)) { // if not on windows, hack to add a basic PATH
- File exe = StandardVMType.findRubyExecutable (fVMInstance
- .getInstallLocation());
- String env = "PATH=" + exe.getParent() + File.pathSeparator
- + "/usr/local/bin" + File.pathSeparator + "/usr/bin" + File.pathSeparator + "PATH";
-
- if (envp != null) {
- env2 = new String[envp.length];
- System.arraycopy(envp, 0, env2, 0, envp.length);
- env2[ envp.length] = env;
- } else {
- env2 = new String[] { env };
- }
- } else {
- env2 = envp;
- }
+ String[] envp = getEnvironment(config);
subMonitor.worked(1);
@@ -272,7 +255,7 @@
subMonitor.subTask(LaunchingMessages.StandardVMRunner_Starting_virtual_machine____3);
Process p= null;
File workingDir = getWorkingDir(config);
- p= exec(cmdLine, workingDir, env2);
+ p= exec(cmdLine, workingDir, envp);
if (p == null) {
return;
}
@@ -289,6 +272,28 @@
subMonitor.done();
}
+ protected String[] getEnvironment(VMRunnerConfiguration config) {
+ String[] envp = config.getEnvironment();
+ if (Platform.getOS().equals(Platform.OS_WIN32))
+ return envp;
+ // if not on windows, hack to add a basic PATH
+ File exe = StandardVMType.findRubyExecutable(fVMInstance
+ .getInstallLocation());
+ String env = "PATH=" + exe.getParent() + File.pathSeparator
+ + "/usr/local/bin" + File.pathSeparator + "/usr/bin"
+ + File.pathSeparator + "PATH";
+
+ String[] env2;
+ if (envp != null) {
+ env2 = new String[envp.length];
+ System.arraycopy(envp, 0, env2, 0, envp.length);
+ env2[envp.length] = env;
+ } else {
+ env2 = new String[] { env };
+ }
+ return env2;
+ }
+
protected void addStreamSync(List<String> arguments) {
File sync = LaunchingPlugin.getFileInPlugin(new Path("ruby").append("flush").append(STREAM_FLUSH_SCRIPT));
arguments.add(LOADPATH_SWITCH);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|