Ejemplo n.º 1
0
  /**
   * gets the path given in database.json and stores it on the Database class
   *
   * @param mainJSON The main json tokener
   */
  public static void initialise(JSONTokener mainJSON) {
    // main.json
    JSONObject mainObj = (new JSONObject(mainJSON)).getJSONObject("main");
    JSONObject settingsObj = mainObj.getJSONObject("settings");
    String databasePath = settingsObj.getString("database");

    // database.json
    JSONObject databaseObj =
        (new JSONObject(JSON.getJSONTokener(databasePath))).getJSONObject("database");

    dbPath = databaseObj.getString("path");

    Debug.println("Database -> " + dbPath);
  }