public void saveToFile(File inputsFile) throws java.io.IOException {
    logger.logComment(
        "Saving "
            + this.getNumberSingleInputs()
            + " inputs to file: "
            + inputsFile.getAbsolutePath());

    // will create the parent dir if it doesn't exist.
    if (!inputsFile.exists()) {
      logger.logComment("File: " + inputsFile + " doesn't exist.");
      if (!inputsFile.getParentFile().exists()) {
        logger.logComment("Parent dir: " + inputsFile.getParentFile() + " doesn't exist.");
        // String parentDirName = inputsFile.getParentFile().getCanonicalPath();
        File projectDir = inputsFile.getParentFile().getParentFile();

        if (!projectDir.exists()) {
          throw new FileNotFoundException(
              "Project dir doesn't exist: " + projectDir.getAbsolutePath());
        }
        // logger.logComment("Going to create dir: "+ parentDirName +" in dir :"+ projectDir);

        logger.logComment("Going to create dir: " + inputsFile.getParentFile());

        inputsFile.getParentFile().mkdir();

        logger.logComment("Success? " + inputsFile.getParentFile().exists());
      }
    }

    FileWriter fw = new FileWriter(inputsFile);

    Enumeration keys = this.myElecInputs.keys();

    while (keys.hasMoreElements()) {
      String input = (String) keys.nextElement();
      ArrayList<SingleElectricalInput> inputs = getInputLocations(input);

      fw.write(input + ":\n");

      for (int i = 0; i < inputs.size(); i++) {
        fw.write(inputs.get(i) + "\n");
      }
    }
    logger.logComment("Finished saving data to file: " + inputsFile.getAbsolutePath());
    fw.flush();
    fw.close();
  }