Be able to use StructuredExec with a null working directory.
1.1 --- a/vcscore/src/org/netbeans/modules/vcscore/cmdline/exec/StructuredExec.java Mon May 03 14:55:09 2004 +0000
1.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/cmdline/exec/StructuredExec.java Mon May 03 15:56:52 2004 +0000
1.3 @@ -29,7 +29,8 @@
1.4 private Argument[] args;
1.5
1.6 /** Creates a new instance of StructuredExec.
1.7 - * @param working The working directory
1.8 + * @param working The working directory or <code>null</code> to use the current
1.9 + * working directory.
1.10 * @param executable The executable
1.11 * @param args The list of arguments passed to the executable
1.12 */
1.13 @@ -41,6 +42,8 @@
1.14
1.15 /**
1.16 * Get the working directory.
1.17 + * @return The working directory or <code>null</code> to use the current
1.18 + * working directory.
1.19 */
1.20 public File getWorking() {
1.21 return working;
1.22 @@ -48,6 +51,8 @@
1.23
1.24 /**
1.25 * Set the working directory.
1.26 + * @param working The working directory or <code>null</code> to use the current
1.27 + * working directory.
1.28 */
1.29 public void setWorking(File working) {
1.30 this.working = working;
1.31 @@ -111,14 +116,17 @@
1.32 }
1.33
1.34 public StructuredExec getExpanded(Hashtable vars, boolean warnUndefVars) {
1.35 - String ew = getWorking().getPath();
1.36 - ew = Variables.expand(vars, ew, warnUndefVars);
1.37 + String ew = null;
1.38 + if (getWorking() != null) {
1.39 + ew = getWorking().getPath();
1.40 + ew = Variables.expand(vars, ew, warnUndefVars);
1.41 + }
1.42 String ee = Variables.expand(vars, getExecutable(), warnUndefVars);
1.43 Argument[] eargs = new Argument[args.length];
1.44 for (int i = 0; i < args.length; i++) {
1.45 eargs[i] = new Argument(Variables.expand(vars, args[i].getArgument(), warnUndefVars), args[i].isLine());
1.46 }
1.47 - return new StructuredExec(new File(ew), ee, eargs);
1.48 + return new StructuredExec((ew != null) ? new File(ew) : null, ee, eargs);
1.49 }
1.50
1.51 /**
2.1 --- a/vcscore/src/org/netbeans/modules/vcscore/commands/CommandCustomizationSupport.java Mon May 03 14:55:09 2004 +0000
2.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/commands/CommandCustomizationSupport.java Mon May 03 15:56:52 2004 +0000
2.3 @@ -412,12 +412,14 @@
2.4 if (executionContext != null) {
2.5 PreCommandPerformer cmdPerf = new PreCommandPerformer(executionContext, vars);
2.6 StructuredExec.Argument[] args = exec.getArguments();
2.7 - String w;
2.8 + String w = null;
2.9 String exe;
2.10 StructuredExec.Argument[] as = new StructuredExec.Argument[args.length];
2.11 try {
2.12 - w = cmdPerf.process(exec.getWorking().getPath());
2.13 - w = insertGlobalOptions(w, vars);
2.14 + if (exec.getWorking() != null) {
2.15 + w = cmdPerf.process(exec.getWorking().getPath());
2.16 + w = insertGlobalOptions(w, vars);
2.17 + }
2.18 exe = cmdPerf.process(exec.getExecutable());
2.19 exe = insertGlobalOptions(exe, vars);
2.20 for (int i = 0; i < args.length; i++) {
2.21 @@ -428,7 +430,7 @@
2.22 } catch (UserCancelException cancelExc) {
2.23 return null;
2.24 }
2.25 - exec = new StructuredExec(new java.io.File(w), exe, as);
2.26 + exec = new StructuredExec((w != null) ? new java.io.File(w) : null, exe, as);
2.27 }
2.28 return exec;
2.29 }