### Function

# GLib path_get_dirname

since: 2.0

#### Declaration

    gchar*
    g_path_get_dirname (
      const gchar* file_name
    )

#### Description

Gets the directory components of a file name. For example, the directory component of `/usr/bin/test` is `/usr/bin`. The directory component of `/` is `/`.

If the file name has no directory components “.” is returned. The returned string should be freed when no longer needed.

Available since: 2.0

#### Parameters

`file_name`

  Type: `const gchar*`

  The name of the file.

  The data is owned by the caller of the function.
  The value is a file system path, using the OS encoding.

#### Return value

Type: `gchar*`

The directory components of the file.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a file system path, using the OS encoding.