View Javadoc

1   package net.sf.tomp.xtcl.command;
2   
3   import net.sf.tomp.xtcl.Context;
4   
5   import java.io.File;
6   
7   /***
8    * DOCUMENT ME!
9    * 
10   * @author tomp
11   */
12  public class Cd extends FileCommand {
13      /***
14       * DOCUMENT ME!
15       * 
16       * @param context DOCUMENT ME!
17       * @return DOCUMENT ME!
18       * @throws Exception DOCUMENT ME!
19       */
20      public int execute(Context context) throws Exception {
21          File newPath = context.getFile(fileName);
22  
23          context.setRealPath(newPath);
24  
25          boolean ok = newPath.exists();
26  
27          return done(context, ok ? 0 : 1);
28      }
29  
30      /***
31       * DOCUMENT ME!
32       * 
33       * @return DOCUMENT ME!
34       */
35      public String toString() {
36          return "CHDIR " + fileName;
37      }
38  }
39  
40  /*
41   * The contents of this file are subject to the Mozilla Public License Version
42   * 1.1 (the "License"); you may not use this file except in compliance with the
43   * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
44   * Software distributed under the License is distributed on an "AS IS" basis,
45   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
46   * the specific language governing rights and limitations under the License. The
47   * Original Code is: all this file. The Initial Developer of the Original Code
48   * is: Tomas Pitner, Masaryk University in Brno, Czech Republic. Contributor(s):
49   */