gebr-tar

gebr-tar

Functions

void (*GebrTarFunc) ()
GebrTar * gebr_tar_create ()
void gebr_tar_append ()
gboolean gebr_tar_compact ()
GebrTar * gebr_tar_new_from_file ()
const gchar * gebr_tar_get_dir ()
gboolean gebr_tar_extract ()
void gebr_tar_foreach ()
void gebr_tar_free ()

Types and Values

  GebrTar

Object Hierarchy


Description

Functions

GebrTarFunc ()

void
(*GebrTarFunc) (const gchar *file,
                gpointer data);

gebr_tar_create ()

GebrTar *
gebr_tar_create (const gchar *path);

gebr_tar_append ()

void
gebr_tar_append (GebrTar *self,
                 const gchar *path);

Inserts path into the tar represented by self . After you inserted all files, call gebr_tar_compact() to generate the tar file.

Parameters

self

a GebrTar created with gebr_tar_create()

 

path

a path for a file accessible through root_dir (see gebr_tar_compact())

 

gebr_tar_compact ()

gboolean
gebr_tar_compact (GebrTar *self,
                  const gchar *root_dir);

Compacts the files into a gziped tar. The root_dir specifies the directory in which files are searched for. The root_dir is equivalent to the -C option of tar command line.

Parameters

self

a GebrTar created with gebr_tar_create()

 

root_dir

the directory in which files are searched for

 

Returns

TRUE if compact was successful, FALSE otherwise.


gebr_tar_new_from_file ()

GebrTar *
gebr_tar_new_from_file (const gchar *path);

Creates a GebrTar from an existing file on the system. You can call gebr_tar_extract() on this object.

Parameters

path

a path for a file on the system

 

Returns

If path exists and it is readable, returns a GebrTar, otherwise NULL is returned.


gebr_tar_get_dir ()

const gchar *
gebr_tar_get_dir (GebrTar *self);

gebr_tar_extract ()

gboolean
gebr_tar_extract (GebrTar *self);

If the GebrTar was created with gebr_tar_new_from_file() constructor, then you can extract it by calling this function on it. The extraction is done in a temporary folder. To access the files you should use the gebr_tar_foreach() method.

The temporary folder is deleted when gebr_tar_free() is called.

Parameters

self

a GebrTar object created with gebr_tar_new_from_file()

 

Returns

TRUE if extraction worked, FALSE otherwise.


gebr_tar_foreach ()

void
gebr_tar_foreach (GebrTar *self,
                  GebrTarFunc func,
                  gpointer data);

Calls func for each file inside the tar file represented by self . You should process the file here, ie move, copy, modify to any place. Notice that the files are extracted into a temporary folder, which will be deleted upon gebr_tar_free() call, so don't rely on them!

Parameters

self

a GebrTar object, after gebr_tar_extract() was called

 

func

a function to be called for each file in self

 

data

data to pass to func calls

 

gebr_tar_free ()

void
gebr_tar_free (GebrTar *self);

If self was extracted with gebr_tar_extract(), then this function will remove all extracted files. After that the structure is freed.

Parameters

self

a GebrTar

 

Types and Values

GebrTar

typedef struct _GebrTar GebrTar;