### Method

# GLib PathBuf set_extension

since: 2.76

#### Declaration [src]

    gboolean
    g_path_buf_set_extension (
      GPathBuf* buf,
      const char* extension
    )

#### Description [src]

Adds an extension to the file name in the path buffer.

If `extension` is `NULL`, the extension will be unset.

If the path buffer does not have a file name set, this function returns `FALSE` and leaves the path buffer unmodified.

Available since: 2.76

#### Parameters

`extension`

  Type: `const char*`

  The file extension.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.

#### Return value

Type: `gboolean`

`TRUE` if the extension was replaced, and `FALSE` otherwise.