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

int gp_filesystem_get_info ( CameraFilesystem fs,
const char *  folder,
const char *  filename,
CameraFileInfo info,
GPContext context 
)

Get information about the specified file.

Parameters:
fs a CameraFilesystem
folder the folder that contains the file
filename the filename
info pointer to CameraFileInfo that receives the information
context a GPContext
Returns:
a gphoto2 error code.

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

References CHECK_NULL, _CameraFilesystem::get_info_func, GP_ERROR_NOT_SUPPORTED, GP_FILE_INFO_MTIME, GP_OK, and _CameraFilesystem::info_data.

Referenced by gp_camera_file_get_info(), and gp_filesystem_set_file_noop().

{
      CameraFilesystemFolder  *f;
      CameraFilesystemFile    *file;
#ifdef HAVE_LIBEXIF
      time_t t;
#endif

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

      GP_DEBUG ("Getting information about '%s' in '%s'...", filename,
              folder);

      if (!fs->get_info_func) {
            gp_context_error (context,
                  _("The filesystem doesn't support getting file "
                    "information"));
            return (GP_ERROR_NOT_SUPPORTED);
      }

      /* Search folder and file and get info if needed */
      CR ( lookup_folder_file (fs, folder, filename, &f, &file, context));

      if (file->info_dirty) {
            CR (fs->get_info_func (fs, folder, filename,
                                    &file->info,
                                    fs->info_data, context));
            file->info_dirty = 0;
      }

      /*
       * If we didn't get GP_FILE_INFO_MTIME, we'll have a look if we
       * can get it from EXIF data.
       */
#ifdef HAVE_LIBEXIF
      if (!(file->info.file.fields & GP_FILE_INFO_MTIME)) {
            GP_DEBUG ("Did not get mtime. Trying EXIF information...");
            t = gp_filesystem_get_exif_mtime (fs, folder, filename);
            if (t) {
                  file->info.file.mtime = t;
                  file->info.file.fields |= GP_FILE_INFO_MTIME;
            }
      }
#endif
      memcpy (info, &file->info, sizeof (CameraFileInfo));
      return (GP_OK);
}


Generated by  Doxygen 1.6.0   Back to index