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 
)

Search a folder that contains a given filename.

Parameters:
fs a CameraFilesystem
filename the name of the file to search in the fs
folder pointer to value where the string is stored in
context a GPContext
Searches a file called filename in the fs 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 fs that something has changed and then gp_filesystem_get_folder in order to find the file.

Note that you get a reference to the string stored in the filesystem structure, so do not free it yourself.

Returns:
a gphoto2 error code.

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

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

{
      int ret;

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

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

      ret = recursive_folder_scan ( fs->rootfolder, filename, folder);
      if (ret == GP_OK) return ret;
      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