### Function

# GLib build_filename

since: 2.0

#### Declaration

    gchar*
    g_build_filename (
      const gchar* first_element,
      ...
    )

#### Description

Creates a filename from a series of elements using the correct separator for the current platform.

On Unix, this function behaves identically to `g_build_path (G_DIR_SEPARATOR_S, first_element, ....)`.

On Windows, it takes into account that either the backslash (`\` or slash (`/`) can be used as separator in filenames, but otherwise behaves as on UNIX. When file pathname separators need to be inserted, the one that last previously occurred in the parameters (reading from left to right) is used.

No attempt is made to force the resulting filename to be an absolute path. If the first element is a relative path, the result will be a relative path.

If you are building a path programmatically you may want to use `GPathBuf` instead.

Available since: 2.0

This function is not directly available to language bindings.

#### Parameters

`first_element`

  Type: `const gchar*`

  The first element in the path.

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

`...`

  Type: ``

  Remaining elements in path, terminated by `NULL`.

#### Return value

Type: `gchar*`

The newly allocated path.

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.