/** ***************************************************************************** */
 void saveProject() {
   try {
     File f1 = new File(base_directory, ".pyproject");
     IvyXmlWriter xw = new IvyXmlWriter(f1);
     outputXml(xw);
     xw.close();
   } catch (IOException e) {
     PybaseMain.logE("Problem writing project file", e);
   }
 }
  void setupDefaults() {
    python_interpreter = project_manager.findInterpreter(null);
    if (python_interpreter == null) PybaseMain.logE("No interpreter found");
    else PybaseMain.logD("Found interpreter " + python_interpreter.getName());

    File src = new File(base_directory, "src");
    if (src.isDirectory() || src.mkdir()) {
      File rsrc = new File("/src");
      IPathSpec ps = project_manager.createPathSpec(rsrc, true, true, true);
      project_paths.add(ps);
    }
  }
  /** ***************************************************************************** */
  private void loadFiles(String pfx, File dir, boolean reload) {
    File[] fls = dir.listFiles(new SourceFilter());

    if (fls != null) {
      for (File f : fls) {
        if (f.isDirectory()) {
          String nm = f.getName();
          String opfx = pfx;
          if (pfx == null) pfx = nm;
          else pfx += "." + nm;
          loadFiles(pfx, f, reload);
          pfx = opfx;
        } else {
          String mnm = f.getName();
          int idx = mnm.lastIndexOf(".");
          if (idx >= 0) mnm = mnm.substring(0, idx);
          if (pfx != null) mnm = pfx + "." + mnm;
          IFileData fd = PybaseFileManager.getFileManager().getNewFileData(f, mnm, this);
          ISemanticData isd = parse_data.get(fd);
          if (reload) {
            // fd.reload();
            isd = null;
          }
          all_files.add(fd);
          if (isd == null) {
            ISemanticData sd = parseFile(fd);
            if (sd != null) {
              System.err.println("PYBASE: PARSE YIELDS: " + sd.getRootNode());
              IvyXmlWriter xw = PybaseMain.getPybaseMain().beginMessage("FILEERROR");
              xw.field("PROJECT", sd.getProject().getName());
              xw.field("FILE", fd.getFile().getPath());
              xw.begin("MESSAGES");
              for (PybaseMessage m : sd.getMessages()) {
                try {
                  System.err.println("PYBASE: PARSE ERROR: " + m);
                  PybaseUtil.outputProblem(m, sd, xw);
                } catch (Throwable t) {
                  PybaseMain.logE("Pybase error message: ", t);
                }
              }
              xw.end("MESSAGES");
              PybaseMain.getPybaseMain().finishMessage(xw);
            }
          }
        }
      }
    }
  }