From f483bc78e46d5b557100cdefd1e0386e94e3d8ea Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Mon, 23 May 2022 22:47:22 +0000 Subject: [PATCH] Move weather.json config to /kolibrios Weather app was moved to /kolibrios a year ago, move its config there too. There is no reason for the config to be in img since nobody in img uses it. Also, update Weather to look for its config not only in /sys but also in /kolibrios. git-svn-id: svn://kolibrios.org@9820 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/Tupfile.lua | 2 +- programs/other/Weather/weather.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/data/Tupfile.lua b/data/Tupfile.lua index b8f2f591d0..c07e0593a2 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -67,7 +67,6 @@ img_files = { {"SETTINGS/NETWORK.INI", "common/settings/network.ini"}, {"SETTINGS/SYSTEM.INI", "common/settings/system.ini"}, {"SETTINGS/TASKBAR.INI", "common/settings/taskbar.ini"}, - {"SETTINGS/weather.json", PROGS .. "/other/Weather/weather.json"}, } -- For russian build, add russian-only files. @@ -726,6 +725,7 @@ tup.append_table(extra_files, { {"kolibrios/utils/kruler", PROGS .. "/other/kruler/kruler"}, {"kolibrios/media/qr_tool", PROGS .. "/media/qr_tool/qr_tool"}, {"kolibrios/utils/weather", PROGS .. "/other/Weather/weather"}, + {"kolibrios/settings/weather.json", PROGS .. "/other/Weather/weather.json"}, {"kolibrios/utils/man2html", PROGS .."/other/man2html/man2html"}, }) end -- tup.getconfig('NO_TCC') ~= 'full' diff --git a/programs/other/Weather/weather.c b/programs/other/Weather/weather.c index e2431042a7..47ccf90506 100644 --- a/programs/other/Weather/weather.c +++ b/programs/other/Weather/weather.c @@ -44,7 +44,8 @@ unsigned WINDOW_W = 230; #define IMAGE_URL "openweathermap.org/img/w/%s.png" Image *blend=NULL; -const char *config_name = "/sys/Settings/weather.json"; +const char *config1_name = "/sys/Settings/weather.json"; +const char *config2_name = "/kolibrios/Settings/weather.json"; unsigned char char_size=1; uint64_t auto_update_time = 0; @@ -227,10 +228,14 @@ void redraw_gui() // Перересовываем интерфейс void get_config(char **city, char **token, char **units) // Загружаем конфиг { - ksys_ufile_t config_j = _ksys_load_file(config_name); + ksys_ufile_t config_j; + config_j = _ksys_load_file(config1_name); if(!config_j.size){ - notify_show("'Configuration file not found!' -E"); - exit(0); + config_j = _ksys_load_file(config2_name); + if(!config_j.size){ + notify_show("'Configuration file not found!' -E"); + exit(0); + } } json_value* value =json_parse (config_j.data, config_j.size); // Парсим конфиг