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

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

Lookup the filename of an indexed file within a folder.

fs a CameraFilesystem
folder the folder where to look up the file with the filenumber
filenumber the number of the file
filename pointer to a filename where the result is stored
context a GPContext
Looks up the filename of file with given filenumber in given folder. See gp_filesystem_number for exactly the opposite functionality.

a gphoto2 error code.

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

References CHECK_NULL, GP_ERROR_DIRECTORY_NOT_FOUND, GP_ERROR_FILE_NOT_FOUND, GP_OK, and _CameraFilesystem::rootfolder.

      CameraFilesystemFolder  *f;
      CameraFilesystemFile    *file;
      int count;
      CHECK_NULL (fs && folder);
      CC (context);
      CA (folder, context);

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

      file = f->files;
      count = 0;
      while (file) {
            if (filenumber == 0)
            file = file->next;

      if (!file) {
            gp_context_error (context, _("Folder '%s' only contains "
                  "%i files, but you requested a file with number %i."),
                  folder, count, filenumber);
            return (GP_ERROR_FILE_NOT_FOUND);
      *filename = file->name;
      return (GP_OK);

Generated by  Doxygen 1.6.0   Back to index