// Marla
class Files {

  boolean checkSaveFile(String filepath) {
    return new File(dataPath(filepath)).exists();
  }

  void loadJson(String jsonfile) {
    // if (!checkSaveFile(jsonfile)) {
    try {
      JSONArray values = loadJSONArray(jsonfile);

      stats_menu.best_game_time = values.getInt(0);
      stats_menu.trees_sawed = values.getInt(1);
      stats_menu.game_time = values.getInt(2);
      println("Savefile found");
      
    } catch (Exception e) {
      println("Savefile not found");
      stats_menu.best_game_time = 90000;
    }
  }

  JSONArray json;
  void savetofile(String filename) {
    json = new JSONArray();

    json.setInt(0, stats_menu.best_game_time);
    json.setInt(1, stats_menu.trees_sawed);
    json.setInt(2, millis() + stats_menu.game_time);
    saveJSONArray(json,"./saves/" + filename + ".json");
  }
  
}
