Beispiel #1
0
static int
delete_file_func (CameraFilesystem *fs, const char *folder,
		  const char *filename, void *data, GPContext *context)
{
	Camera *camera = data;
	int n, c, flash_file_count;

	/* FIXME deleting a single file for flash/card cams should work */
	/* Get the file number from the CameraFileSystem */
	CHECK (n =
	       gp_filesystem_number (camera->fs, folder, filename, context));

	if (cam_has_flash(camera->pl) || cam_has_card(camera->pl) ) {
		CHECK (spca50x_flash_get_filecount
					(camera->pl, &flash_file_count));
	} else {
		/* should not happen really */
		return GP_ERROR;
	}
	if (n < flash_file_count) {
		return spca500_flash_delete_file (camera->pl, n);
	}

	CHECK (c = gp_filesystem_count (camera->fs, folder, context));
	if (n + 1 != c) {
		const char *name;

		gp_filesystem_name (fs, "/", c - 1, &name, context);
		gp_context_error (context,
				  _("Your camera only supports deleting the "
				   "last file on the camera. In this case, this "
				   "is file '%s'."), name);
		return (GP_ERROR);
	}
	CHECK (spca50x_sdram_delete_file (camera->pl, n));
	return GP_OK;
}
Beispiel #2
0
static int
delete_file_func (CameraFilesystem *fs, const char *folder,
		  const char *filename, void *data, GPContext *context)
{
	Camera *camera = data;
	int n, c;

	/* Get the file number from the CameraFileSystem */
	CHECK (n = gp_filesystem_number (camera->fs, folder, filename, 
				         context));
	CHECK (c = gp_filesystem_count (camera->fs, folder, context));
	if (n + 1 != c) {
		const char *name;

		gp_filesystem_name (fs, "/", c - 1, &name, context);
		gp_context_error (context,
											_("Your camera only supports deleting " 
												"the last file on the camera. In this "
												"case, this is file '%s'."), name);
		return (GP_ERROR);
	}
	CHECK (gsmart300_delete_file (camera->pl, n));
	return GP_OK;
}