언어 설정

Menu
Sites
Language
how to receive a path of the file?

what correct event is necessary for a file choice?

    evas_object_smart_callback_add(file_select, "chosen", clicked_select_file, ad->navi);

the selected file isn't written through fprintf. Only path.

void
clicked_select_file(void *data, Evas_Object *obj, void *event_info)
{
    /* узнать расположение файла */

		const char *tmp = elm_fileselector_path_get(obj);

		/* добавить строку в буфер */

		int len = strlen (tmp);
		if ( log_file == NULL ){
			log_file = calloc(len + 1, 1);
			strncpy(log_file, tmp, len);
		}
		else{
			free(log_file);
			log_file = calloc(len + 1, 1);
			strncpy(log_file, tmp, len);
		}
		FILE *log_list = fopen("/opt/home/app/log","w");
		fprintf(log_list,"%s\n",log_file);
		fclose(log_list);
}

 

Responses

2 댓글
Dmitry Naidolinksy

already I know as.

Mango Bar

You can get the resource directory file path using the following function. You just need to give your file name as function parameter.

char* get_filepath(char *filename)
{

    char filepath[1000] = {0,};
    char *resource_path = app_get_resource_path(); // get the application resource directory path
    if(resource_path)
    {        
        snprintf(filepath,1000,"%s%s",resource_path,filename);
        dlog_print(DLOG_INFO,"TAG","Path: %s",filepath);
        free(resource_path);
    }

    return filepath;
}