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

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

gp_filesystem_get_folder: : a CameraFilesystem : the name of the file to search in the : : a GPContext

Searches a file called in the and returns the first occurrency. This functionality is needed for camera drivers that cannot figure out where a file gets created after capturing an image although the name of the image is known. Usually, those drivers will call gp_filesystem_reset in order to tell the that something has changed and then gp_filesystem_get_folder in order to find the file.

Return value: a gphoto2 error code.

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

References _CameraFilesystem::count, and _CameraFilesystem::folder.

      int x, y;

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

      CR (gp_filesystem_scan (fs, "/", filename, context));

      for (x = 0; x < fs->count; x++)
            for (y = 0; y < fs->folder[x].count; y++)
                  if (!strcmp (fs->folder[x].file[y].name, filename)) {
                        *folder = fs->folder[x].name;
                        return (GP_OK);

      gp_context_error (context, _("Could not find file '%s'."), filename);
      return (GP_ERROR_FILE_NOT_FOUND);

Generated by  Doxygen 1.6.0   Back to index