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 
)

gp_filesystem_get_info: : a CameraFilesystem : : : : a GPContext

Return value: a gphoto2 error code.

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

References _CameraFilesystem::folder, _CameraFilesystem::get_info_func, gp_filesystem_number(), and _CameraFilesystem::info_data.

{
      int x, y;
#ifdef HAVE_EXIF
      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 (x = gp_filesystem_folder_number (fs, folder, context));
      CR (y = gp_filesystem_number (fs, folder, filename, context));
      if (fs->folder[x].file[y].info_dirty) {
            CR (fs->get_info_func (fs, folder, filename, 
                                    &fs->folder[x].file[y].info,
                                    fs->info_data, context));
            fs->folder[x].file[y].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_EXIF
      if (!(fs->folder[x].file[y].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) {
                  fs->folder[x].file[y].info.file.mtime = t;
                  fs->folder[x].file[y].info.file.fields |=
                                          GP_FILE_INFO_MTIME;
            }
      }
#endif

      memcpy (info, &fs->folder[x].file[y].info, sizeof (CameraFileInfo));

      return (GP_OK);
}


Generated by  Doxygen 1.6.0   Back to index