--- a/ui/common/properties.c Fri Dec 12 12:00:34 2025 +0100 +++ b/ui/common/properties.c Fri Dec 12 12:28:32 2025 +0100 @@ -44,7 +44,7 @@ #include <cx/buffer.h> #include <cx/hash_map.h> -#include "ucx_properties.h" +#include <cx/properties.h> static CxMap *application_properties; static CxMap *language; @@ -145,6 +145,25 @@ #endif } +static int load_properties(FILE *file, CxMap *map) { + CxProperties prop; + cxPropertiesInitDefault(&prop); + char buf[8192]; + size_t r; + CxPropertiesStatus status = CX_PROPERTIES_NO_ERROR; + while((r = fread(buf, 1, 8192, file)) > 0) { + cxPropertiesFilln(&prop, buf, r); + cxstring key; + cxstring value; + status = cxPropertiesNext(&prop, &key, &value); + if(status > CX_PROPERTIES_OK) { + break; + } + cxMapPut(map, key, cx_strdup(value).ptr); + } + return status == CX_PROPERTIES_NO_ERROR ? 0 : 1; +} + void uic_load_app_properties() { application_properties = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 128); application_properties->collection.simple_destructor = free; @@ -206,8 +225,8 @@ return; } - if(ucx_properties_load(application_properties, file)) { - fprintf(stderr, "Ui Error: Cannot load application properties.\n"); + if(load_properties(file, application_properties)) { + fprintf(stderr, "Error: Cannot load application properties.\n"); } fclose(file); @@ -228,11 +247,13 @@ } int ret = 0; - if(ucx_properties_store(application_properties, file)) { - fprintf(stderr, "Ui Error: Cannot store application properties.\n"); - ret = 1; + CxMapIterator i = cxMapIterator(application_properties); + cx_foreach(CxMapEntry *, entry, i) { + fprintf(file, "%.*s: %s\n", (int)entry->key->len, entry->key->data, entry->value); } + cxMapRehash(application_properties); + fclose(file); free(path); @@ -360,8 +381,8 @@ return 1; } - if(ucx_properties_load(lang, file)) { - fprintf(stderr, "Ui Error: Cannot parse language file: %s.\n", path); + if(load_properties(file, lang)) { + fprintf(stderr, "Error: Cannot parse language file: %s.\n", path); } fclose(file);