|
|
|
@ -279,7 +279,10 @@ dictionary *yon_dictionary_get(dictionary **dict, char *key)
|
|
|
|
|
|
|
|
|
|
|
|
dictionary *yon_dictionary_rip(dictionary *dict)
|
|
|
|
dictionary *yon_dictionary_rip(dictionary *dict)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!dict->next&&!dict->prev) return NULL;
|
|
|
|
if (!dict->next&&!dict->prev) {
|
|
|
|
|
|
|
|
free(dict);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (!dict->next)
|
|
|
|
else if (!dict->next)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dictionary *prev = dict->prev;
|
|
|
|
dictionary *prev = dict->prev;
|
|
|
|
@ -2003,6 +2006,47 @@ int yon_file_create_full_path(char *path, int rules){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config_str yon_file_list_dirs (char *path, int *size){
|
|
|
|
|
|
|
|
(*size)=0;
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(path)&&!access(path,F_OK)){
|
|
|
|
|
|
|
|
config_str final = NULL;
|
|
|
|
|
|
|
|
DIR *current_dir = opendir(path);
|
|
|
|
|
|
|
|
struct dirent* cur_dir;
|
|
|
|
|
|
|
|
while ((cur_dir=readdir(current_dir))){
|
|
|
|
|
|
|
|
if (cur_dir->d_type==DT_DIR &&(strcmp(cur_dir->d_name, ".") && strcmp(cur_dir->d_name, ".."))){
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(final,size,cur_dir->d_name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
closedir(current_dir);
|
|
|
|
|
|
|
|
return final;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config_str yon_file_ls(char *path, int *size){
|
|
|
|
|
|
|
|
(*size)=0;
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(path)&&!access(path,F_OK)){
|
|
|
|
|
|
|
|
config_str final = NULL;
|
|
|
|
|
|
|
|
DIR *current_dir = opendir(path);
|
|
|
|
|
|
|
|
struct dirent* cur_dir;
|
|
|
|
|
|
|
|
while ((cur_dir=readdir(current_dir))){
|
|
|
|
|
|
|
|
if ((strcmp(cur_dir->d_name, ".") && strcmp(cur_dir->d_name, ".."))){
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(final,size,cur_dir->d_name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
closedir(current_dir);
|
|
|
|
|
|
|
|
return final;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_file_is_directory(const char *path)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct stat path_stat;
|
|
|
|
|
|
|
|
stat(path, &path_stat);
|
|
|
|
|
|
|
|
return S_ISDIR(path_stat.st_mode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// terminal-using functions
|
|
|
|
// terminal-using functions
|
|
|
|
|
|
|
|
|
|
|
|
int yon_launch_app_with_arguments(char *name, char *args)
|
|
|
|
int yon_launch_app_with_arguments(char *name, char *args)
|
|
|
|
|