Logo Search packages:      
Sourcecode: libgphoto2 version File versions

int gp_filesystem_put_file ( CameraFilesystem fs,
const char *  folder,
CameraFile file,
GPContext context 
)

Upload a file to a folder on the device filesystem.

Parameters:
fs a CameraFilesystem
folder the folder where to put the file into
file the file
context a GPContext
Uploads a file to the camera if a put_file_func has been previously supplied to the fs. If the upload is successful, the file will get cached in the fs.

Returns:
a gphoto2 error code.

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

References CHECK_NULL, _CameraFilesystem::folder_data, GP_ERROR_DIRECTORY_NOT_FOUND, GP_ERROR_NOT_SUPPORTED, _CameraFilesystem::put_file_func, and _CameraFilesystem::rootfolder.

Referenced by gp_camera_folder_put_file().

{
      CameraFilesystemFolder  *f;

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

      /* Do we support file upload? */
      if (!fs->put_file_func) {
            gp_context_error (context, _("The filesystem does not support "
                  "upload of files."));
            return (GP_ERROR_NOT_SUPPORTED);
      }

      /* Search the folder */
      f = lookup_folder (fs, fs->rootfolder, folder, context);
      if (!f) return (GP_ERROR_DIRECTORY_NOT_FOUND);

      /* Upload the file */
      CR (fs->put_file_func (fs, folder, file, fs->folder_data, context));
      /* And upload it to internal structure too */
      return append_file (fs, f, file, context);
}


Generated by  Doxygen 1.6.0   Back to index