### Function

# GLib mkdir_with_parents

since: 2.8

#### Declaration

    gint
    g_mkdir_with_parents (
      const gchar* pathname,
      gint mode
    )

#### Description

Create a directory if it doesn’t already exist. Create intermediate parent directories as needed, too.

Available since: 2.8

#### Parameters

`pathname`

  Type: `const gchar*`

  A pathname in the GLib file name encoding.

  The data is owned by the caller of the function.
  The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.

`mode`

  Type: `gint`

  Permissions to use for newly created directories.

#### Return value

Type: `gint`

0 if the directory already exists, or was successfully created. Returns -1 if an error occurred, with errno set.