## FmArchiver FmArchiver — Support for packing and unpacking archiver utilities. |

## Synopsis

    struct              FmArchiver;
    gboolean            fm_archiver_create_archive          (FmArchiver *archiver,
                                                             GAppLaunchContext *ctx,
                                                             FmPathList *files);
    gboolean            fm_archiver_extract_archives        (FmArchiver *archiver,
                                                             GAppLaunchContext *ctx,
                                                             FmPathList *files);
    gboolean            fm_archiver_extract_archives_to     (FmArchiver *archiver,
                                                             GAppLaunchContext *ctx,
                                                             FmPathList *files,
                                                             FmPath *dest_dir);
    const GList *       fm_archiver_get_all                 ();
    FmArchiver *        fm_archiver_get_default             ();
    gboolean            fm_archiver_is_mime_type_supported  (FmArchiver *archiver,
                                                             const char *type);
    void                fm_archiver_set_default             (FmArchiver *archiver);

## Description

`include`: libfm/fm.h

The FmArchiver represents support for utilities which can pack files into archive and/or extract them.

## Details

### struct FmArchiver

    struct FmArchiver {
        char* program;
        char* create_cmd;
        char* extract_cmd;
        char* extract_to_cmd;
        char** mime_types;
    };

char *`program`; | archiver program
char *`create_cmd`; | command to create archive
char *`extract_cmd`; | command to extract files from archive
char *`extract_to_cmd`; | command to extract files into destined directory
char **`mime_types`; | list of archive types the archiver supports

### fm_archiver_create_archive ()

    gboolean            fm_archiver_create_archive          (FmArchiver *archiver,
                                                             GAppLaunchContext *ctx,
                                                             FmPathList *files);

Creates an archive for `files`.

`archiver` : | the archiver descriptor
`ctx` : | a launch context. [allow-none]
`files` : | files to pack into archive
Returns : | `FALSE`.

Since 0.1.9

### fm_archiver_extract_archives ()

    gboolean            fm_archiver_extract_archives        (FmArchiver *archiver,
                                                             GAppLaunchContext *ctx,
                                                             FmPathList *files);

Extracts files from archives.

`archiver` : | the archiver descriptor
`ctx` : | a launch context. [allow-none]
`files` : | archives to unpack
Returns : | `FALSE`.

Since 0.1.9

### fm_archiver_extract_archives_to ()

    gboolean            fm_archiver_extract_archives_to     (FmArchiver *archiver,
                                                             GAppLaunchContext *ctx,
                                                             FmPathList *files,
                                                             FmPath *dest_dir);

Extracts files from archives into `dest_dir`.

`archiver` : | archiver descriptor
`ctx` : | a launch context. [allow-none]
`files` : | archives to unpack
`dest_dir` : | directory where files should be extracted to
Returns : | `FALSE`.

Since 0.1.9

### fm_archiver_get_all ()

    const GList *       fm_archiver_get_all                 ();

Retrieves a list of FmArchiver of all GUI archivers known to libfm.

This API is not thread-safe and should be used only in default context.

Returns : | list of archivers.

Since 0.1.9

### fm_archiver_get_default ()

    FmArchiver *        fm_archiver_get_default             ();

Retrieves default GUI archiver used by libfm.

This API is not thread-safe and should be used only in default context.

Returns : | archiver descriptor.

Since 0.1.9

### fm_archiver_is_mime_type_supported ()

    gboolean            fm_archiver_is_mime_type_supported  (FmArchiver *archiver,
                                                             const char *type);

### fm_archiver_set_default ()

    void                fm_archiver_set_default             (FmArchiver *archiver);

Sets default GUI archiver used by libfm.

This API is not thread-safe and should be used only in default context.

`archiver` : | archiver descriptor

Since 0.1.9