Ejemplo n.º 1
0
static int test_tixx_group_support(const char * message,
                                   const char * input_file_1,
                                   const char * input_file_2,
                                   const char * input_group_file,
                                   const char * output_group_file)
{
	char files[2][1024];
	char *array[3] = { 0 };
	int ret = -1;

	strncpy(files[0], PATH(input_file_1), 1023);
	files[0][1023] = 0;
	strncpy(files[1], PATH(input_file_2), 1023);
	files[1][1023] = 0;
	array[0] = files[0];
	array[1] = files[1];

	printf("%s", message);
	ret = tifiles_group_files(array, PATH(output_group_file));
	if (!ret)
	{
		tifiles_file_display(PATH(output_group_file));
		ret = compare_files(PATH(input_group_file), PATH2(output_group_file));
	}

	return ret;
}
Ejemplo n.º 2
0
int gfm_tifiles_group(const char **filenames, int type)
{
	char **ptr;
	gchar *input;
	gchar *target = NULL;
	gchar *dirname = g_path_get_dirname(filenames[0]);
	//	gchar *basename = g_path_get_basename(filenames[0]);
	int err = 0;

	// Check for selection consistency
	for(ptr = (char **)filenames; *ptr; ptr++)
	{
		if(tifiles_file_is_group(*ptr) || tifiles_file_is_tigroup(*ptr))
		{
			msgbox_one(MSGBOX_ERROR, _("Group files are not allowed in selection."));
			return -1;
		}

		if(tifiles_file_is_flash(*ptr) && type != TIFILE_TIGROUP)
		{
			msgbox_one(MSGBOX_ERROR, _("FLASH files are not allowed in group files."));
			return -1;
		}
	}

	// Ask for group name
	input = msgbox_input(_("Group files"), "group", _("Group name: "));
	if(input == NULL)
		return -1;

	// And group
	if(type == TIFILE_GROUP)
	{
		target = g_strconcat(dirname, G_DIR_SEPARATOR_S, input,	".", 
			tifiles_fext_of_group(tifiles_file_get_model(filenames[0])), NULL);
		g_free(input);

		err = tifiles_group_files((char **)filenames, target);
	}
	else if(type == TIFILE_TIGROUP)
	{
		target = g_strconcat(dirname, G_DIR_SEPARATOR_S, input,	".tig", NULL);
		g_free(input);

		err = tifiles_tigroup_files((char **)filenames, target);
	}

	if(err)
	{
		gchar *str;

		tifiles_error_get(err, &str);
		msgbox_one(MSGBOX_ERROR, str);
		g_free(str);
	}
	g_free(target);

	return 0;
}