## GoFile

GoFile

## Synopsis

                        GOFilePermissions;
    enum                GODotDot;
    #define             F_OK
    #define             X_OK
    #define             W_OK
    #define             R_OK
    char*               go_filename_simplify                (const char *filename,
                                                             GODotDot dotdot,
                                                             gboolean make_absolute);
    char*               go_url_simplify                     (const char *uri);
    char*               go_filename_from_uri                (const char *uri);
    char*               go_filename_to_uri                  (const char *filename);
    char*               go_url_resolve_relative             (const char *ref_uri,
                                                             const char *rel_uri);
    char*               go_url_make_relative                (const char *uri,
                                                             const char *ref_uri);
    char*               go_shell_arg_to_uri                 (const char *arg);
    char*               go_basename_from_uri                (const char *uri);
    char*               go_dirname_from_uri                 (const char *uri,
                                                             gboolean brief);
    gcharconst **       go_shell_argv_to_glib_encoding      (gint argc,
                                                             gchar const **argv);
    void                go_shell_argv_to_glib_encoding_free (void);
    GsfInput*           go_file_open                        (char const *uri,
                                                             GError **err);
    GsfOutput*          go_file_create                      (char const *uri,
                                                             GError **err);
    GSList*             go_file_split_urls                  (char const *data);
    gchar*              go_file_get_owner_name              (char const *uri);
    gchar*              go_file_get_group_name              (char const *uri);
    GOFilePermissions*  go_get_file_permissions             (char const *uri);
    void                go_set_file_permissions             (char const *uri,
                                                             GOFilePermissions *file_permissions);
    time_t              go_file_get_date_accessed           (char const *uri);
    time_t              go_file_get_date_modified           (char const *uri);
    time_t              go_file_get_date_changed            (char const *uri);
    gint                go_file_access                      (char const *uri,
                                                             gint mode);
    gchar*              go_url_decode                       (gchar const *text);
    gchar*              go_url_encode                       (gchar const *text,
                                                             int type);
    GError*             go_url_show                         (gchar const *url);
    gboolean            go_url_check_extension              (gchar const *uri,
                                                             gchar const *std_ext,
                                                             gchar **new_uri);
    gchar*              go_get_mime_type                    (gchar const *uri);
    gchar*              go_get_mime_type_for_data           (gconstpointer data,
                                                             int data_size);
    gcharconst	*        go_mime_type_get_description        (gchar const *mime_type);

## Description

## Details

### GOFilePermissions

    typedef struct {
    	gboolean owner_read;
    	gboolean owner_write;
    	gboolean owner_execute;

    	gboolean group_read;
    	gboolean group_write;
    	gboolean group_execute;

    	gboolean others_read;
    	gboolean others_write;
    	gboolean others_execute;
    } GOFilePermissions;

### enum GODotDot

    typedef enum {
    	GO_DOTDOT_SYNTACTIC,    /* Assume no symlinks.  */
    	GO_DOTDOT_TEST,         /* Check.  */
    	GO_DOTDOT_LEAVE         /* Leave alone.  */
    } GODotDot;

### F_OK

    #  define F_OK 0

### X_OK

    #  define X_OK 1

### W_OK

    #  define W_OK 2

### R_OK

    #  define R_OK 4

### go_filename_simplify ()

    char*               go_filename_simplify                (const char *filename,
                                                             GODotDot dotdot,
                                                             gboolean make_absolute);

`filename` : |
`dotdot` : |
`make_absolute` : |
Returns : |

### go_url_simplify ()

    char*               go_url_simplify                     (const char *uri);

`uri` : |
Returns : |

### go_filename_from_uri ()

    char*               go_filename_from_uri                (const char *uri);

`uri` : |
Returns : |

### go_filename_to_uri ()

    char*               go_filename_to_uri                  (const char *filename);

`filename` : |
Returns : |

### go_url_resolve_relative ()

    char*               go_url_resolve_relative             (const char *ref_uri,
                                                             const char *rel_uri);

`ref_uri` : |
`rel_uri` : |
Returns : |

### go_url_make_relative ()

    char*               go_url_make_relative                (const char *uri,
                                                             const char *ref_uri);

`uri` : |
`ref_uri` : |
Returns : |

### go_shell_arg_to_uri ()

    char*               go_shell_arg_to_uri                 (const char *arg);

`arg` : |
Returns : |

### go_basename_from_uri ()

    char*               go_basename_from_uri                (const char *uri);

Decode the final path component. Returns as UTF-8 encoded suitable for display.

`uri` : |
Returns : |

### go_dirname_from_uri ()

    char*               go_dirname_from_uri                 (const char *uri,
                                                             gboolean brief);

Decode the all but the final path component. Returns as UTF-8 encoded suitable for display.

`uri` : |
`brief` : | if TRUE, hide "file://" if present.
Returns : |

### go_shell_argv_to_glib_encoding ()

    gcharconst **       go_shell_argv_to_glib_encoding      (gint argc,
                                                             gchar const **argv);

`argc` : |
`argv` : |
Returns : |

### go_shell_argv_to_glib_encoding_free ()

    void                go_shell_argv_to_glib_encoding_free (void);

### go_file_open ()

    GsfInput*           go_file_open                        (char const *uri,
                                                             GError **err);

Try all available methods to open a file or return an error

`uri` : |
`err` : | GError
Returns : |

### go_file_create ()

    GsfOutput*          go_file_create                      (char const *uri,
                                                             GError **err);

`uri` : |
`err` : |
Returns : |

### go_file_split_urls ()

    GSList*             go_file_split_urls                  (char const *data);

`data` : |
Returns : |

### go_file_get_owner_name ()

    gchar*              go_file_get_owner_name              (char const *uri);

`uri` : |
Returns : |

### go_file_get_group_name ()

    gchar*              go_file_get_group_name              (char const *uri);

`uri` : |
Returns : |

### go_get_file_permissions ()

    GOFilePermissions*  go_get_file_permissions             (char const *uri);

`uri` : |
Returns : |

### go_set_file_permissions ()

    void                go_set_file_permissions             (char const *uri,
                                                             GOFilePermissions *file_permissions);

`uri` : |
`file_permissions` : |

### go_file_get_date_accessed ()

    time_t              go_file_get_date_accessed           (char const *uri);

`uri` : |
Returns : |

### go_file_get_date_modified ()

    time_t              go_file_get_date_modified           (char const *uri);

`uri` : |
Returns : |

### go_file_get_date_changed ()

    time_t              go_file_get_date_changed            (char const *uri);

`uri` : |
Returns : |

### go_file_access ()

    gint                go_file_access                      (char const *uri,
                                                             gint mode);

`uri` : |
`mode` : |
Returns : |

### go_url_decode ()

    gchar*              go_url_decode                       (gchar const *text);

`text` : |
Returns : |

### go_url_encode ()

    gchar*              go_url_encode                       (gchar const *text,
                                                             int type);

`text` : |
`type` : |
Returns : |

### go_url_show ()

    GError*             go_url_show                         (gchar const *url);

`url` : |
Returns : |

### go_url_check_extension ()

    gboolean            go_url_check_extension              (gchar const *uri,
                                                             gchar const *std_ext,
                                                             gchar **new_uri);

Modifies given `uri` by adding the extension `std_ext` if needed. If no `std_ext` is given or `uri` already has some extension, it just copies `uri`.

Value in new_uri: newly allocated string which you should free after use, containing (optionally) modified uri.

`uri` : | Uri
`std_ext` : | Standard extension for the content type
`new_uri` : | New uri
Returns : | FALSE if the uri has an extension not matching `std_ext`

### go_get_mime_type ()

    gchar*              go_get_mime_type                    (gchar const *uri);

`uri` : |
Returns : |

### go_get_mime_type_for_data ()

    gchar*              go_get_mime_type_for_data           (gconstpointer data,
                                                             int data_size);

`data` : |
`data_size` : |
Returns : |

### go_mime_type_get_description ()

    gcharconst	*        go_mime_type_get_description        (gchar const *mime_type);

`mime_type` : |
Returns : |