Changed new config file creation method

pull/15/head
parent 6ea6619568
commit f2bfcfa5ba

@ -285,11 +285,11 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
if (!yon_char_is_empty(file)){ if (!yon_char_is_empty(file)){
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){
FILE *source_file = fopen("/lib/ublinux/templates/ublinux-data.ini","r"); char *command_creation = ubconfig_file_create(file);
FILE *dest_file = fopen(file,"w"); system(command_creation);
int ch; if (access(file,0)!=F_OK){
while ((ch = fgetc(source_file)) != EOF) { yon_ubl_status_box_render(CUSTOM_CONFIG_CREATION_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
fputc(ch, dest_file); return NULL;
} }
} }
} }

@ -94,12 +94,15 @@
#define SAVE_MODE_RAM_HOME_LABEL _("Sandbox with profile saving") #define SAVE_MODE_RAM_HOME_LABEL _("Sandbox with profile saving")
#define SAVE_MODE_HDD_LABEL _("HDD sandbox") #define SAVE_MODE_HDD_LABEL _("HDD sandbox")
#define SAVE_MODE_HDD_HOME_LABEL _("HDD sandbox with profile saving") #define SAVE_MODE_HDD_HOME_LABEL _("HDD sandbox with profile saving")
#define CUSTOM_CONFIG_CREATION_ERROR_LABEL _("New configuration file creation failed")
#endif #endif
#define dull_parameter_get_command "ubconfig --source global get users PARAMETER" #define dull_parameter_get_command "ubconfig --source global get users PARAMETER"
#define SAVE_MODE_GET_COMMAND "ubconfig --raw --source system get [config] SYSTEMBOOT_STATEMODE" #define SAVE_MODE_GET_COMMAND "ubconfig --raw --source system get [config] SYSTEMBOOT_STATEMODE"
#define ubconfig_file_create(target) yon_char_unite("ubconfig --target \"",target,"\" create",NULL)
typedef enum SAVE_MODE_TYPE { typedef enum SAVE_MODE_TYPE {
SAVE_MODE_FULL, SAVE_MODE_FULL,
SAVE_MODE_MODULE, SAVE_MODE_MODULE,

Loading…
Cancel
Save