From fd4d701367463630067cf9bd89ae6374787d21fb Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Thu, 19 Mar 2026 11:26:16 +0600 Subject: [PATCH] Added new function; yon_dir_get_contents marked as deprecated --- source/libublsettings-file.c | 11 ++++ source/libublsettings-locale.c | 2 +- source/libublsettings.h | 92 +++++++++++++--------------------- 3 files changed, 47 insertions(+), 58 deletions(-) diff --git a/source/libublsettings-file.c b/source/libublsettings-file.c index 35e8b5e..5043a18 100644 --- a/source/libublsettings-file.c +++ b/source/libublsettings-file.c @@ -140,6 +140,17 @@ config_str yon_file_ls(char *path, int *size){ return NULL; } +char *yon_file_get_parent(const char *path){ + if (yon_char_is_empty(path)|| !strstr(path,"/")) return NULL; + char *parent_path = NULL; + int size; + config_str parsed = yon_char_parse(path,&size,"/"); + free(parsed[size-1]); + parsed[size-1] = NULL; + parent_path = yon_char_parsed_to_string_full(parsed,size,"/"); + return parent_path; +} + int yon_file_is_directory(const char *path) { struct stat path_stat; diff --git a/source/libublsettings-locale.c b/source/libublsettings-locale.c index cddf1ec..67c0fd5 100644 --- a/source/libublsettings-locale.c +++ b/source/libublsettings-locale.c @@ -68,7 +68,7 @@ void yon_locale_set(struct yon_locale *target,char *locale_name){ void yon_locale_init(){ int size; - config_str locales_list = yon_dir_get_contents(locales_path,&size); + config_str locales_list = yon_file_ls(locales_path,&size); locales_hash_table = yon_hash_new(size*2,yon_str_hash); for (int i=0;i