Comments removal; variable rename; custom config creation owner fix

pull/57/head
parent 6242c6f3d6
commit 733a56b797
No known key found for this signature in database
GPG Key ID: FF1D842BF4DDE92B

@ -487,32 +487,21 @@ void yon_loaded_config_set_sections_from_sections_dictionary(struct loaded_confi
struct loaded_config *yon_config_get_compared(char *command){ struct loaded_config *yon_config_get_compared(char *command){
if (command){ if (command){
int size; int size;
config_str config = yon_config_load(command,&size); config_str config_p = yon_config_load(command,&size);
config_str temporary = NULL; config_str temporary = NULL;
int temp_size=0; int temp_size=0;
if (config&&size>0){ if (config_p&&size>0){
for (int i=0;i<size;i++){ for (int i=0;i<size;i++){
if (!yon_char_is_empty(config[i])&&strcmp(config[i],"(null)\n")){ if (!yon_char_is_empty(config_p[i])&&strcmp(config_p[i],"(null)\n")){
yon_char_remove_last_symbol(config[i],'\n'); yon_char_remove_last_symbol(config_p[i],'\n');
yon_char_parsed_add_or_create_if_exists(temporary,&temp_size,config[i]); yon_char_parsed_add_or_create_if_exists(temporary,&temp_size,config_p[i]);
} }
} }
yon_char_parsed_free(config,size); yon_char_parsed_free(config_p,size);
} }
if (!temporary) return NULL; if (!temporary) return NULL;
struct loaded_config *loaded = yon_config_convert_parameter(temporary,temp_size); struct loaded_config *loaded = yon_config_convert_parameter(temporary,temp_size);
// int parsed_size;
// config_str parsed_command = yon_char_parse(command,&parsed_size,";");
// dictionary *sections = NULL;
// for (int i=0;i<parsed_size;i++){
// int dull_size;
// yon_dictionary_add_or_create_if_exists_with_data(sections,yon_command_get_section(parsed_command[i]),yon_command_get_parameters(command,&dull_size));
// }
// yon_loaded_config_set_sections_from_sections_dictionary(loaded,sections);
// yon_dictionary_free_all(sections,free);
return loaded; return loaded;
} }
@ -539,6 +528,8 @@ char *yon_custom_config_init(GtkFileChooserAction type){
if (!strstr(file,".ini")) file = yon_char_append(file,".ini"); if (!strstr(file,".ini")) file = yon_char_append(file,".ini");
if (access(file,0)!=F_OK){ if (access(file,0)!=F_OK){
char *command_creation = ubconfig_file_create(file); char *command_creation = ubconfig_file_create(file);
struct passwd *user = getpwnam(yon_ubl_root_user_get());
chown(file,user->pw_uid,user->pw_gid);
int a = system(command_creation); int a = system(command_creation);
free(command_creation); free(command_creation);
if (access(file,0)!=F_OK){ if (access(file,0)!=F_OK){
@ -557,9 +548,9 @@ char *yon_custom_config_init(GtkFileChooserAction type){
} }
/* /*
============ ===========================================================
init section init section
============ ===========================================================
*/ */
void on_save_parameters(GtkWidget *self, template_saving_window *window){ void on_save_parameters(GtkWidget *self, template_saving_window *window){

Loading…
Cancel
Save