libgphoto2 photo camera library (libgphoto2) API: libgphoto2_port/libgphoto2_port/gphoto2-port-portability.c File Reference

libgphoto2 photo camera library (libgphoto2) API 2.5.2

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

Functions
gphoto2-port-portability.c File Reference

Various portability functions. More...

`#include "config.h"`
`#include <stdio.h>`
`#include <gphoto2/gphoto2-port.h>`
`#include <gphoto2/gphoto2-port-result.h>`

## Functions
int | gp_system_mkdir (const char *dirname)
| mkdir UNIX functionality More...
int | gp_system_rmdir (const char *dirname)
| rmdir UNIX functionality More...
gp_system_dir | gp_system_opendir (const char *dirname)
| opendir UNIX functionality More...
gp_system_dirent | gp_system_readdir (gp_system_dir d)
| readdir UNIX functionality More...
const char * | gp_system_filename (gp_system_dirent de)
| retrieve UNIX filename out of a directory entry More...
int | gp_system_closedir (gp_system_dir dir)
| closedir UNIX functionality More...
int | gp_system_is_file (const char *filename)
| check if passed filename is a file More...
int | gp_system_is_dir (const char *dirname)
| check if passed filename is a directory More...

## Detailed Description

Various portability functions.

This file contains various portability functions that make non UNIX (Windows) ports easier.

## Function Documentation

int gp_system_closedir | ( | gp_system_dir | dir | ) |

closedir UNIX functionality

Parameters

  dir | directory to close

Closes a directory after readdir operations.

Returns
  a gphoto error code

References GP_OK.

const char* gp_system_filename | ( | gp_system_dirent | de | ) |

retrieve UNIX filename out of a directory entry

Parameters

  de | directory entry as returned from gp_system_readdir()

Extracts a filename out of the passed directory entry.

Returns
  the filename of the directory entry

int gp_system_is_dir | ( | const char * | dirname | ) |

check if passed filename is a directory

Parameters

  dirname | file name to check

Checks whether the passed in dirname is a directory and returns this as boolean.

Returns
  boolean flag whether passed filename is a directory.

int gp_system_is_file | ( | const char * | filename | ) |

check if passed filename is a file

Parameters

  filename | file name to check

Checks whether the passed in filename is a file and returns this as boolean.

Returns
  boolean flag whether passed filename is a file.

int gp_system_mkdir | ( | const char * | dirname | ) |

mkdir UNIX functionality

Parameters

  dirname | directory to create

Creates a new directory.

Returns
  a gphoto error code

References GP_ERROR, and GP_OK.

gp_system_dir gp_system_opendir | ( | const char * | dirname | ) |

opendir UNIX functionality

Parameters

  dirname | directory to open

Opens a directory for readdir and later closedir operations, to enumerate its contents.

Returns
  a directory handle for use in gp_system_readdir() and gp_system_closedir()

gp_system_dirent gp_system_readdir | ( | gp_system_dir | d | ) |

readdir UNIX functionality

Parameters

  d | directory to enumerate

Reads one directory entry from the specified directory handle as returned from gp_system_opendir(). Use gp_system_filename() to extract the filename from the returned value.

Returns
  a new gp_system_dirent or NULL

int gp_system_rmdir | ( | const char * | dirname | ) |

rmdir UNIX functionality

Parameters

  dirname | directory to remove

Removes a empty directory.

Returns
  a gphoto error code

References GP_ERROR, and GP_OK.