Logo Search packages:      
Sourcecode: libgphoto2 version File versions  Download package

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 1091 of file gphoto2-filesys.c.

References CHECK_NULL, _CameraFilesystem::delete_file_func, _CameraFilesystem::file_data, GP_ERROR_NOT_SUPPORTED, and GP_OK.

Referenced by gp_camera_file_delete().

      CameraFilesystemFolder  *f;
      CameraFilesystemFile    *file;

      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 (lookup_folder_file (fs, folder, filename, &f, &file, 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, f, file));
      return (GP_OK);

Generated by  Doxygen 1.6.0   Back to index