Logo Search packages:      
Sourcecode: libgphoto2 version File versions

int gp_filesystem_delete_file ( CameraFilesystem fs,
const char *  folder,
const char *  filename,
GPContext context 

Delete a file from a folder.

fs a CameraFilesystem
folder a folder in which to delete the file
filename the name of the file to delete
context a GPContext
If a delete_file_func has been supplied to the fs, this function will be called and, if this function returns without error, the file will be removed from the fs.

a gphoto2 error code.

Definition at line 1088 of file gphoto2-filesys.c.

References CHECK_NULL, _CameraFilesystem::delete_file_func, _CameraFilesystem::file_data, GP_ERROR_NOT_SUPPORTED, and gp_filesystem_number().

Referenced by gp_camera_file_delete().

        int x, y;

      CHECK_NULL (fs && folder && filename);
      CC (context);
      CA (folder, context);

      /* First of all, do we support file deletion? */
      if (!fs->delete_file_func) {
            gp_context_error (context, _("You have been trying to delete "
                  "'%s' from folder '%s', but the filesystem does not "
                  "support deletion of files."), filename, folder);
            return (GP_ERROR_NOT_SUPPORTED);

      /* Search the folder and the file */
      CR (x = gp_filesystem_folder_number (fs, folder, context));
      CR (y = gp_filesystem_number (fs, folder, filename, context));

      gp_context_status (context, _("Deleting '%s' from folder '%s'..."),
                     filename, folder);
      /* Delete the file */
      CR (fs->delete_file_func (fs, folder, filename,
                          fs->file_data, context));
      CR (delete_file (fs, x, y));

      return (GP_OK);

Generated by  Doxygen 1.6.0   Back to index