Weather: Fix config filepath

git-svn-id: svn://kolibrios.org@8589 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2021-02-10 20:35:30 +00:00
parent 32c989d925
commit b533776ce7
3 changed files with 7 additions and 4 deletions

View File

@ -67,7 +67,7 @@ img_files = {
{"SETTINGS/NETWORK.INI", "common/settings/network.ini"}, {"SETTINGS/NETWORK.INI", "common/settings/network.ini"},
{"SETTINGS/SYSTEM.INI", "common/settings/system.ini"}, {"SETTINGS/SYSTEM.INI", "common/settings/system.ini"},
{"SETTINGS/TASKBAR.INI", "common/settings/taskbar.ini"}, {"SETTINGS/TASKBAR.INI", "common/settings/taskbar.ini"},
{"SETTINGS/WEATHER.JSON", PROGS .. "/other/Weather/weather.json"}, {"SETTINGS/weather.json", PROGS .. "/other/Weather/weather.json"},
} }
-- For russian build, add russian-only files. -- For russian build, add russian-only files.

View File

@ -1,5 +1,5 @@
diff16 'tp-common.asm',0,$ diff16 'tp-common.asm',0,$
include '../../../debug.inc'
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
proc clear_selection ;//////////////////////////////////////////////////////// proc clear_selection ;////////////////////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -71,6 +71,8 @@ endp
proc get_real_length ;//////////////////////////////////////////////////////// proc get_real_length ;////////////////////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[esi+EDITOR_LINE_DATA.Size] mov eax,[esi+EDITOR_LINE_DATA.Size]
debug_print_dec eax
debug_print "|"
@@: cmp byte[esi+eax+sizeof.EDITOR_LINE_DATA-1],' ' @@: cmp byte[esi+eax+sizeof.EDITOR_LINE_DATA-1],' '
jne @f jne @f
dec eax dec eax

View File

@ -45,6 +45,7 @@ unsigned WINDOW_W = 230;
#define IMAGE_URL "openweathermap.org/img/w/%s.png" #define IMAGE_URL "openweathermap.org/img/w/%s.png"
Image *blend=NULL; Image *blend=NULL;
const char *config_name = "/sys/Settings/weather.json";
unsigned char char_size=1; unsigned char char_size=1;
uint64_t AutoUpdateTime = 0; uint64_t AutoUpdateTime = 0;
@ -228,12 +229,12 @@ void RedrawGUI() // Перересовываем интерфейс
void get_config(char **City, char **Token, char **Units) // Загружаем конфиг void get_config(char **City, char **Token, char **Units) // Загружаем конфиг
{ {
FILE *config_j = fopen("/sys/Settings/weather.json", "rb"); FILE *config_j = fopen(config_name, "rb");
if(config_j==NULL){ if(config_j==NULL){
notify_show("'Configuration file not found!' -E"); notify_show("'Configuration file not found!' -E");
exit(0); exit(0);
} }
size_t size = _ksys_get_filesize("weather.json"); // Получаем размер файла size_t size = _ksys_get_filesize((char*)config_name); // Получаем размер файла
char *config_buff = safe_malloc(size+1); char *config_buff = safe_malloc(size+1);
if(size != fread(config_buff, sizeof(char), size, config_j)){ if(size != fread(config_buff, sizeof(char), size, config_j)){
notify_show("'The configuration file was not fully read!' -E"); notify_show("'The configuration file was not fully read!' -E");