![]() |
![]() |
![]() |
OGMRip Reference Manual | ![]() |
---|---|---|---|---|
#include <ogmrip-fs.h> enum OGMRipFsError; #define OGMRIP_FS_ERROR gchar* ogmrip_fs_get_tmp_dir (void); void ogmrip_fs_set_tmp_dir (const gchar *dir); gboolean ogmrip_fs_mkdir (const gchar *path, mode_t mode, GError **error); gboolean ogmrip_fs_rmdir (const gchar *path, gboolean recursive, GError **error); gchar* ogmrip_fs_mktemp (const gchar *tmpl, GError **error); gchar* ogmrip_fs_mkftemp (const gchar *tmpl, GError **error); gchar* ogmrip_fs_mkdtemp (const gchar *tmpl, GError **error); gchar* ogmrip_fs_lntemp (const gchar *oldpath, const gchar *newtmpl, gboolean symln, GError **error); gint ogmrip_fs_open_tmp (const gchar *tmpl, gchar **name_used, GError **error); gint64 ogmrip_fs_get_left_space (const gchar *filename); gchar* ogmrip_fs_get_mount_point (const gchar *filename); void ogmrip_fs_unref (gchar *filename, gboolean do_unlink); gboolean ogmrip_fs_rename (const gchar *old_name, const gchar *new_name, GError **error);
typedef enum { OGMRIP_FS_ERROR_NONE, OGMRIP_FS_ERROR_INTERNAL } OGMRipFsError;
Error codes returned by OGMRipFs functions.
#define OGMRIP_FS_ERROR ogmrip_fs_error_quark ()
Error domain for fs operations. Errors in this domain will be from the OGMRipFsError enumeration. See GError for information on error domains.
gchar* ogmrip_fs_get_tmp_dir (void);
Returns OGMRip's temporary directory.
Returns : | The temporaty directory |
void ogmrip_fs_set_tmp_dir (const gchar *dir);
Sets OGMRip's temporary directory. If dir
is NULL, OGMRip's temporary
directory will be the system's temporary directory.
dir : |
The new temporary directory |
gboolean ogmrip_fs_mkdir (const gchar *path, mode_t mode, GError **error);
Create the all the directories in path
, if they do not already exist.
path : |
A path of directories |
mode : |
The file mode |
error : |
A location to return an error of type OGMRIP_FS_ERROR |
Returns : | TRUE on success, FALSE if an error was set
|
gboolean ogmrip_fs_rmdir (const gchar *path, gboolean recursive, GError **error);
If recusive
is FALSE
, removes the directory of path
if it is empty. If
recusive
is TRUE
, also removes its content recursively.
path : |
A path to a directory |
recursive : |
TRUE to remove the directory and its content recursively
|
error : |
A location to return an error of type G_FILE_ERROR |
Returns : | TRUE on success, FALSE if an error was set
|
gchar* ogmrip_fs_mktemp (const gchar *tmpl, GError **error);
Creates a file in OGMRip's temporary directory (as returned by
ogmrip_fs_get_tmp_dir()
).
tmpl : |
Template for file name, as in g_mkstemp() , basename only
|
error : |
A location to return an error of type G_FILE_ERROR |
Returns : | The actual name used, or NULL |
gchar* ogmrip_fs_mkftemp (const gchar *tmpl, GError **error);
Creates a fifo in OGMRip's temporary directory (as returned by
ogmrip_fs_get_tmp_dir()
).
tmpl : |
Template for fifo name, basename only |
error : |
A location to return an error of type G_FILE_ERROR |
Returns : | The actual name used, or NULL |
gchar* ogmrip_fs_mkdtemp (const gchar *tmpl, GError **error);
Creates a directory in OGMRip's temporary directory (as returned by
ogmrip_fs_get_tmp_dir()
).
tmpl : |
Template for directory name, basename only |
error : |
A location to return an error of type G_FILE_ERROR |
Returns : | The actual name used, or NULL |
gchar* ogmrip_fs_lntemp (const gchar *oldpath, const gchar *newtmpl, gboolean symln, GError **error);
Creates a link in OGMRip's temporary directory (as * returned by
ogmrip_fs_get_tmp_dir()
) to æn existing file.
oldpath : |
A path to an existing file |
newtmpl : |
Template for link name, basename only |
symln : |
TRUE to create a symbolic link
|
error : |
A location to return an error of type G_FILE_ERROR |
Returns : | The actual name used, or NULL |
gint ogmrip_fs_open_tmp (const gchar *tmpl, gchar **name_used, GError **error);
Opens a file for writing in OGMRip's temporary directory (as returned by
g_get_tmp_dir()
).
tmpl : |
Template for file name, as in g_mkstemp() , basename only
|
name_used : |
Location to store actual name used |
error : |
A location to return an error of type G_FILE_ERROR |
Returns : | A file handle (as from open() ) to the file opened for reading and
writing. The file is opened in binary mode on platforms where there is a
difference. The file handle should be closed with close() . In case of errors,
-1 is returned and error will be set.
|
gint64 ogmrip_fs_get_left_space (const gchar *filename);
Returns the space left in bytes on the device containing filename
.
filename : |
A path to a filename |
Returns : | The space left in bytes, or -1 |
gchar* ogmrip_fs_get_mount_point (const gchar *filename);
Returns the mount point of the device containing filename
.
filename : |
A path to a filename |
Returns : | The moint point, or NULL |
void ogmrip_fs_unref (gchar *filename, gboolean do_unlink);
If do_unlink
is TRUE
, recursively removes filename
then frees the memory
pointed to by filename
.
filename : |
A path to a filename |
do_unlink : |
TRUE to also remove the file
|
gboolean ogmrip_fs_rename (const gchar *old_name, const gchar *new_name, GError **error);
If recusive
is FALSE
, removes the directory of path
if it is empty. If
recusive
is TRUE
, also removes its content recursively.
old_name : |
The path to an existing filename |
new_name : |
The new name of the file |
error : |
A location to return an error of type G_FILE_ERROR |
Returns : | TRUE on success, FALSE if an error was set
|