### Function

# GLib path_get_basename

#### Declaration [src]

    gchar*
    g_path_get_basename (
      const gchar* file_name
    )

#### Description [src]

Gets the last component of the filename.

If `file_name` ends with a directory separator it gets the component before the last slash. If `file_name` consists only of directory separators (and on Windows, possibly a drive letter), a single separator is returned. If `file_name` is empty, it gets “.”.

#### 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 platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.

#### Return value

Type: `gchar*`

A newly allocated string containing the last component of the filename.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.