Exemplo n.º 1
0
  /**
   * path is location of the main .gcode file, because this is also simplest to use when opening the
   * file from the finder/explorer.
   */
  public Sketch(MainWindow editor, String path) throws IOException {
    this.editor = editor;

    File mainFile = new File(path);
    // System.out.println("main file is " + mainFile);

    mainFilename = mainFile.getName();
    // System.out.println("main file is " + mainFilename);

    // get the name of the sketch by chopping .gcode
    // off of the main file name
    if (mainFilename.endsWith(".gcode")) {
      name = mainFilename.substring(0, mainFilename.length() - 6);
    } else {
      name = mainFilename;
      mainFilename = mainFilename + ".gcode";
    }

    tempBuildFolder = Base.getBuildFolder();
    // Base.addBuildFolderToClassPath();

    String parentPath = new File(path).getParent();
    if (parentPath == null) {
      parentPath = ".";
    }
    folder = new File(parentPath);
    // System.out.println("sketch dir is " + folder);

    load();
  }