summaryrefslogtreecommitdiff
path: root/SOURCE/Viewer_vesy/LoadSetup.pde
blob: b7c4a494f9ce12a16c17afd284090c435a57b716 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//*****************************************************
//  чтение файла настроек и данных
//  все настройки, клиенты, камазы и 1 взвешивания = data/

void loadSetup() {
  JSONArray values;

  //  Считываем путь до папки с настройками из put/sourse.json:
  try {
    values = loadJSONArray(put + "source.json");      //  = data/ + ...  //  Ядиск
    for (int i = 0; i < values.size(); i++) {
      JSONObject animal = values.getJSONObject(i);
      filePath = animal.getString("filePath");        //  адрес папки с Ядиск
      println(filePath);
    }
  }
  catch (Exception e) {
    printFileLog("File 'source.json' - undetected");
    selectFolder("Select a folder to process:", "folderSelected");
    while (!flagWork) {
      delay(100);
    }
  }

  values = new JSONArray();
  JSONObject animal = new JSONObject();
  animal.setString("filePath", filePath);
  values.setJSONObject(0, animal);
  saveJSONArray(values, "data/" + "source.json");

  println("NEXT--->>>");
}