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

int gp_filesystem_count ( CameraFilesystem fs,
const char *  folder,
GPContext context 
)

Count files a folder of a filesystem.

Parameters:
fs a CameraFilesystem
folder a folder in which to count the files
context a GPContext
Counts the files in the folder.

Returns:
The number of files in the folder or a gphoto2 error code.

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

References CHECK_NULL, GP_ERROR_DIRECTORY_NOT_FOUND, and _CameraFilesystem::rootfolder.

{
      int x;
      CameraFilesystemFolder  *f;
      CameraFilesystemFile    *file;

      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);

      x = 0;
      file = f->files;
      while (file) {
            x++;
            file = file->next;
      }
      return x;
}


Generated by  Doxygen 1.6.0   Back to index